Support tags for input args
Enable users to specify tags to be used to import and reference commits. Change-Id: If2a9a2fa52d6c34ab110ae7a7fdbd02fae82e3b9 Closes-Bug: #1547180
This commit is contained in:
@@ -304,7 +304,7 @@ class UpstreamMergeBaseSearcher(LogDedentMixin, Searcher):
|
|||||||
["refs/remotes/*/{0}".format(ref) for ref in self.patterns])
|
["refs/remotes/*/{0}".format(ref) for ref in self.patterns])
|
||||||
|
|
||||||
if search_tags:
|
if search_tags:
|
||||||
self._references.append(
|
self._references.extend(
|
||||||
["refs/tags/{0}".format(ref) for ref in self.patterns])
|
["refs/tags/{0}".format(ref) for ref in self.patterns])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@@ -116,8 +116,8 @@ class LocateChangesWalk(LocateChangesStrategy):
|
|||||||
|
|
||||||
super(LocateChangesWalk, self).__init__(*args, **kwargs)
|
super(LocateChangesWalk, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.searcher = UpstreamMergeBaseSearcher(branch=branch,
|
self.searcher = UpstreamMergeBaseSearcher(
|
||||||
patterns=search_refs)
|
branch=branch, patterns=search_refs, search_tags=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def previous_upstream(self):
|
def previous_upstream(self):
|
||||||
|
@@ -101,6 +101,24 @@ class TestImportCommand(TestWithScenarios, BaseTestCase):
|
|||||||
|
|
||||||
self._check_tree_state()
|
self._check_tree_state()
|
||||||
|
|
||||||
|
def test_command_with_tags(self):
|
||||||
|
# add tag for each branch/ref and test with added tag
|
||||||
|
parser_args = []
|
||||||
|
for arg in self.parser_args:
|
||||||
|
if (arg.startswith('-') or arg in ("import",)):
|
||||||
|
parser_args.append(arg)
|
||||||
|
continue
|
||||||
|
|
||||||
|
tag_name = "tag-gu-%s" % arg.replace('~', '-')
|
||||||
|
self.git.tag(tag_name, arg)
|
||||||
|
parser_args.append(tag_name)
|
||||||
|
|
||||||
|
args = self.parser.parse_args(parser_args)
|
||||||
|
self.assertThat(args.cmd.run(args), Equals(True),
|
||||||
|
"import command failed to complete successfully")
|
||||||
|
|
||||||
|
self._check_tree_state()
|
||||||
|
|
||||||
def _check_tree_state(self):
|
def _check_tree_state(self):
|
||||||
|
|
||||||
expected = getattr(self, 'expect_found', None)
|
expected = getattr(self, 'expect_found', None)
|
||||||
|
Reference in New Issue
Block a user