From c5f7faf61682fd3b05e2472735407e570b2de3ba Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 16 Jun 2018 12:50:57 -0700 Subject: [PATCH 1/2] Fix detection of upstream version branches with continue 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. --- cherry_picker/cherry_picker/cherry_picker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cherry_picker/cherry_picker/cherry_picker.py b/cherry_picker/cherry_picker/cherry_picker.py index abf37b7..0d15662 100755 --- a/cherry_picker/cherry_picker/cherry_picker.py +++ b/cherry_picker/cherry_picker/cherry_picker.py @@ -422,7 +422,7 @@ def get_base_branch(cherry_pick_branch): """ return '2.7' from 'backport-sha-2.7' """ - prefix, sep, base_branch = cherry_pick_branch.rpartition('-') + prefix, sha, base_branch = cherry_pick_branch.split('-', 2) return base_branch From f90d9933b12e1f81f6863c4ae58e028b27befb4a Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 16 Jun 2018 15:16:17 -0700 Subject: [PATCH 2/2] Update tests to check for base branches which have dashes in them. --- cherry_picker/cherry_picker/test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index c5d8615..2fcfd57 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -33,15 +33,16 @@ def changedir(d): def test_get_base_branch(): + # The format of cherry-pick branches we create are "backport-{SHA}-{base_branch}" cherry_pick_branch = 'backport-afc23f4-2.7' result = get_base_branch(cherry_pick_branch) assert result == '2.7' -def test_get_base_branch_without_dash(): - cherry_pick_branch ='master' +def test_get_base_branch_which_has_dashes(): + cherry_pick_branch ='backport-afc23f4-baseprefix-2.7-basesuffix' result = get_base_branch(cherry_pick_branch) - assert result == 'master' + assert result == 'baseprefix-2.7-basesuffix' @mock.patch('subprocess.check_output') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy