diff options
author | Zuul <zuul@review.openstack.org> | 2018-09-19 17:09:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-09-19 17:09:43 +0000 |
commit | f6260701fa5cc214bfddaf0cf7b05aeeea5cefec (patch) | |
tree | 2aa3c6166ce856d31a2955a4f76ee5edd44b57b5 | |
parent | 6587639df25c798c3977720ae55018b5ec350bfa (diff) | |
parent | dcbfb32b0536900d5d6aa0809421b84a164812ad (diff) | |
download | git-review-f6260701fa5cc214bfddaf0cf7b05aeeea5cefec.tar.gz |
Merge "Use new %topic=XXXX syntax for topic pushes"
-rwxr-xr-x | git_review/cmd.py | 16 | ||||
-rw-r--r-- | git_review/tests/test_git_review.py | 9 |
2 files changed, 15 insertions, 10 deletions
diff --git a/git_review/cmd.py b/git_review/cmd.py index 80f122e..3442000 100755 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -1675,16 +1675,18 @@ def _main(): run_custom_script("draft") cmd = "git push %s HEAD:refs/%s/%s" % (remote, ref, branch) + push_options = [] if options.topic is not None: topic = options.topic else: topic = None if options.notopic else get_topic(branch) + if topic and topic != branch: - cmd += "/%s" % topic + push_options.append("topic=%s" % topic) if options.reviewers: assert_valid_reviewers(options.reviewers) - cmd += "%" + ",".join("r=%s" % r for r in options.reviewers) + push_options += ["r=%s" % r for r in options.reviewers] if options.regenerate: print("Amending the commit to regenerate the change id\n") @@ -1698,17 +1700,19 @@ def _main(): "'/^Change-Id:/d'") if options.wip: - cmd += '\%wip' + push_options.append('wip') if options.ready: - cmd += '\%ready' + push_options.append('ready') if options.private: - cmd += '\%private' + push_options.append('private') if options.remove_private: - cmd += '\%remove-private' + push_options.append('remove-private') + if push_options: + cmd += "%" + ",".join(push_options) if options.dry: print("Please use the following command " "to send your commits to review:\n") diff --git a/git_review/tests/test_git_review.py b/git_review/tests/test_git_review.py index cd3fc91..fe778f8 100644 --- a/git_review/tests/test_git_review.py +++ b/git_review/tests/test_git_review.py @@ -386,12 +386,13 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase): def test_git_review_t(self): self._run_git_review('-s') self._simple_change('test file modified', 'commit message for bug 654') - self._assert_branch_would_be('master/zat', extra_args=['-t', 'zat']) + self._assert_branch_would_be('master%topic=zat', + extra_args=['-t', 'zat']) def test_bug_topic(self): self._run_git_review('-s') self._simple_change('a change', 'new change for bug 123') - self._assert_branch_would_be('master/bug/123') + self._assert_branch_would_be('master%topic=bug/123') def test_bug_topic_newline(self): self._run_git_review('-s') @@ -401,7 +402,7 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase): def test_bp_topic(self): self._run_git_review('-s') self._simple_change('a change', 'new change for blueprint asdf') - self._assert_branch_would_be('master/bp/asdf') + self._assert_branch_would_be('master%topic=bp/asdf') def test_bp_topic_newline(self): self._run_git_review('-s') @@ -475,7 +476,7 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase): def test_git_review_T(self): self._run_git_review('-s') self._simple_change('test file modified', 'commit message for bug 456') - self._assert_branch_would_be('master/bug/456') + self._assert_branch_would_be('master%topic=bug/456') self._assert_branch_would_be('master', extra_args=['-T']) def test_git_review_T_t(self): |