Commit b5effa1f authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

git cl + git numberer: fix 3+ lineage ordering.

In other words, end 2 end test was a really awesome idea.

R=machenbach@chromium.org,sergiyb@chromium.org
BUG=642493
TEST=git cl land of https://codereview.chromium.org/2575043003 succeeded

Change-Id: I568ce79baf109b2aa556e4343527b63f39c10d00
Reviewed-on: https://chromium-review.googlesource.com/419478
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 8f15f3ec
......@@ -3333,7 +3333,7 @@ class ChangeDescription(object):
parsed_footers[i] = (k.replace('Cr-', 'Cr-Original-'), v)
# Add Position and Lineage footers based on the parent.
lineage = parent_footer_map.get('Cr-Branched-From', [])
lineage = list(reversed(parent_footer_map.get('Cr-Branched-From', [])))
if parent_position[0] == dest_ref:
# Same branch as parent.
number = int(parent_position[1]) + 1
......
......@@ -387,6 +387,32 @@ class TestGitClBasic(unittest.TestCase):
'Cr-Branched-From: parenthash-refs/heads/branch@{#5}\n'
'Cr-Branched-From: somehash-refs/heads/master@{#12}')
def test_git_number_ever_moooooooore_lineage(self):
self.maxDiff = 10000
actual = self._test_git_number(
'CQ commit on fresh new branch + numbering.\n'
'\n'
'NOTRY=True\n'
'NOPRESUBMIT=True\n'
'BUG=\n'
'\n'
'Review-Url: https://codereview.chromium.org/2577703003\n'
'Cr-Commit-Position: refs/heads/gnumb-test/br@{#1}\n'
'Cr-Branched-From: 0749ff9edc-refs/heads/gnumb-test/cq@{#4}\n'
'Cr-Branched-From: 5c49df2da6-refs/heads/master@{#41618}',
dest_ref='refs/heads/gnumb-test/cl',
child_msg='git cl on fresh new branch + numbering.\n'
'\n'
'Review-Url: https://codereview.chromium.org/2575043003 .\n')
self.assertEqualByLine(
actual,
'git cl on fresh new branch + numbering.\n'
'\n'
'Review-Url: https://codereview.chromium.org/2575043003 .\n'
'Cr-Commit-Position: refs/heads/gnumb-test/cl@{#1}\n'
'Cr-Branched-From: parenthash-refs/heads/gnumb-test/br@{#1}\n'
'Cr-Branched-From: 0749ff9edc-refs/heads/gnumb-test/cq@{#4}\n'
'Cr-Branched-From: 5c49df2da6-refs/heads/master@{#41618}')
def test_git_number_cherry_pick(self):
actual = self._test_git_number(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment