Don't set topic when submitting no-topic patches

Change-Id: I8f8880791ad7e46fb9e18623ab8bd295457424b2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2018-10-16 15:10:35 +01:00
parent 03768832c4
commit af955c932e
3 changed files with 22 additions and 0 deletions

View File

@ -943,6 +943,10 @@ def get_topic(target_branch):
branch_parts = branch_name.split("/")
if len(branch_parts) >= 3 and branch_parts[0] == "review":
# We don't want to set the review number as the topic
if branch_parts[2].isdigit():
return
topic = "/".join(branch_parts[2:])
if VERBOSE:
print("Using change number %s for the topic of the change "

View File

@ -383,6 +383,18 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
finally:
os.environ.update(LANG=lang_env)
def test_no_topic(self):
"""Test on change with no topic.
This will be checked out as 'review/{owner}/{ID}'. We don't want to set
the topic to '{ID}'.
"""
self._run_git_review('-s')
curr_branch = self._run_git('rev-parse', '--abbrev-ref', 'HEAD')
self._run_git('checkout', '-b', 'review/johndoe/123456')
self._simple_change('test file modified', 'derp derp derp')
self._assert_branch_would_be(curr_branch)
def test_git_review_t(self):
self._run_git_review('-s')
self._simple_change('test file modified', 'commit message for bug 654')

View File

@ -0,0 +1,6 @@
---
fixes:
- |
If a patch has no topic, downloading it will result in a topic of
``review/{owner}/{ID}``. Previously, submitting this would then set the
topic to ``{ID}``. This was incorrect behavior and is now resolved.