Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff8a587

Browse filesBrowse files
abadgerMariatta
authored andcommitted
Fix detection of upstream version branches with continue (#265)
cherry_picker has recently grown support for prefixed version branches (like stable-2.6). The --continue support had a bug with those branches where it wouldn't account for the fact that those branches could have extra dashes in them and thus mixing branch name with sha. This commit should fix those situations.
1 parent 79a35e7 commit ff8a587
Copy full SHA for ff8a587

File tree

Expand file treeCollapse file tree

2 files changed

+5
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-4
lines changed

‎cherry_picker/cherry_picker/cherry_picker.py

Copy file name to clipboardExpand all lines: cherry_picker/cherry_picker/cherry_picker.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def get_base_branch(cherry_pick_branch):
422422
"""
423423
return '2.7' from 'backport-sha-2.7'
424424
"""
425-
prefix, sep, base_branch = cherry_pick_branch.rpartition('-')
425+
prefix, sha, base_branch = cherry_pick_branch.split('-', 2)
426426
return base_branch
427427

428428

‎cherry_picker/cherry_picker/test.py

Copy file name to clipboardExpand all lines: cherry_picker/cherry_picker/test.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ def changedir(d):
3333

3434

3535
def test_get_base_branch():
36+
# The format of cherry-pick branches we create are "backport-{SHA}-{base_branch}"
3637
cherry_pick_branch = 'backport-afc23f4-2.7'
3738
result = get_base_branch(cherry_pick_branch)
3839
assert result == '2.7'
3940

4041

41-
def test_get_base_branch_without_dash():
42-
cherry_pick_branch ='master'
42+
def test_get_base_branch_which_has_dashes():
43+
cherry_pick_branch ='backport-afc23f4-baseprefix-2.7-basesuffix'
4344
result = get_base_branch(cherry_pick_branch)
44-
assert result == 'master'
45+
assert result == 'baseprefix-2.7-basesuffix'
4546

4647

4748
@mock.patch('subprocess.check_output')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.