-
Notifications
You must be signed in to change notification settings - Fork 67
Master depth #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Master depth #7
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ def test_load(self): | |
repos[0], | ||
{'cwd': '/product_attribute', | ||
'fetch_all': False, | ||
'defaults': {}, | ||
'merges': [{'ref': '8.0', 'remote': 'oca'}, | ||
{'ref': 'refs/pull/105/head', 'remote': 'oca'}, | ||
{'ref': 'refs/pull/106/head', 'remote': 'oca'}], | ||
|
@@ -57,6 +58,52 @@ def test_load(self): | |
'url': | ||
'git+ssh://[email protected]/acsone/product-attribute.git'}]) | ||
|
||
def test_load_defaults(self): | ||
config_yaml = dedent(""" | ||
/web: | ||
defaults: | ||
depth: 1 | ||
remotes: | ||
oca: https://github.com/OCA/web.git | ||
acsone: git+ssh://[email protected]/acsone/web.git | ||
merges: | ||
- | ||
remote: oca | ||
ref: 8.0 | ||
depth: 1000 | ||
- oca refs/pull/105/head | ||
- | ||
remote: oca | ||
ref: refs/pull/106/head | ||
target: acsone aggregated_branch_name | ||
""") | ||
repos = config.get_repos(self._parse_config(config_yaml)) | ||
self.assertEquals(len(repos), 1) | ||
# remotes are configured as dict therefore the order is not preserved | ||
# when parsed | ||
remotes = repos[0]['remotes'] | ||
repos[0]['remotes'] = [] | ||
self.assertDictEqual( | ||
repos[0], | ||
{'cwd': '/web', | ||
'fetch_all': False, | ||
'defaults': {'depth': 1}, | ||
'merges': [{'ref': '8.0', 'remote': 'oca', 'depth': 1000}, | ||
{'ref': 'refs/pull/105/head', 'remote': 'oca'}, | ||
{'ref': 'refs/pull/106/head', 'remote': 'oca'}], | ||
'remotes': [], | ||
'shell_command_after': [], | ||
'target': {'branch': 'aggregated_branch_name', | ||
'remote': 'acsone'}}) | ||
assertfn = self.assertItemsEqual if PY2 else self.assertCountEqual | ||
assertfn( | ||
remotes, | ||
[{'name': 'oca', | ||
'url': 'https://github.com/OCA/web.git'}, | ||
{'name': 'acsone', | ||
'url': | ||
'git+ssh://[email protected]/acsone/web.git'}]) | ||
|
||
def test_load_shell_command_after(self): | ||
"""Shell command after are alway parser as a list | ||
""" | ||
|
@@ -181,6 +228,21 @@ def test_load_merges_exception(self): | |
ex.exception.args[0], | ||
'/product_attribute: Merge remote oba not defined in remotes.') | ||
|
||
config_yaml = dedent(""" | ||
/web: | ||
remotes: | ||
oca: https://github.com/OCA/web.git | ||
merges: | ||
- | ||
depth: 1 | ||
target: oca aggregated_branch | ||
""") | ||
with self.assertRaises(ConfigException) as ex: | ||
config.get_repos(self._parse_config(config_yaml)) | ||
self.assertEquals( | ||
ex.exception.args[0], | ||
'/web: Merge lacks mandatory `remote` or `ref` keys.') | ||
|
||
def test_load_target_exception(self): | ||
config_yaml = """ | ||
/product_attribute: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yajo Is this line still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, there was a problem with Travis' git version: it fails with
git pull --depth 2 --no-edit remote ref
, but works withgit pull --no-edit --depth 2 remote ref
. I had to add the line to see if that was the bug because local tests worked.I guess it's good to keep that line as reference, just in case for future Travis vs localhost git version conflicts.