diff --git a/.pick_status.json b/.pick_status.json index 90ac6724082..e3d9410ed61 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -134,7 +134,7 @@ "description": "pick-ui: fix parsing of multiple `backport-to:` lines", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/bin/pick/core.py b/bin/pick/core.py index 987f6621f6a..7cf3496037a 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -292,11 +292,12 @@ async def resolve_nomination(commit: 'Commit', version: str) -> 'Commit': commit.nominated = True return commit - if backport_to := IS_BACKPORT.search(out): - if version in backport_to.groups(): - commit.nominated = True - commit.nomination_type = NominationType.BACKPORT - return commit + if backport_to := IS_BACKPORT.findall(out): + for match in backport_to: + if version in match: + commit.nominated = True + commit.nomination_type = NominationType.BACKPORT + return commit if cc_to := IS_CC.search(out): if cc_to.groups() == (None, None) or version in cc_to.groups(): diff --git a/bin/pick/core_test.py b/bin/pick/core_test.py index d7579be71ac..0e58a668205 100644 --- a/bin/pick/core_test.py +++ b/bin/pick/core_test.py @@ -252,9 +252,8 @@ class TestRE: Reviewed-by: Bas Nieuwenhuizen """) - backport_to = core.IS_BACKPORT.search(message) - assert backport_to is not None - assert backport_to.groups() == ('19.2', None) + backport_to = core.IS_BACKPORT.findall(message) + assert backport_to == [('19.2', '')] def test_multiple_release_space(self): """Tests commit with more than one branch specified""" @@ -268,9 +267,8 @@ class TestRE: Reviewed-by: Pierre-Eric Pelloux-Prayer """) - backport_to = core.IS_BACKPORT.search(message) - assert backport_to is not None - assert backport_to.groups() == ('19.1', '19.2') + backport_to = core.IS_BACKPORT.findall(message) + assert backport_to == [('19.1', '19.2')] def test_multiple_release_comma(self): """Tests commit with more than one branch specified""" @@ -284,9 +282,20 @@ class TestRE: Reviewed-by: Pierre-Eric Pelloux-Prayer """) - backport_to = core.IS_BACKPORT.search(message) - assert backport_to is not None - assert backport_to.groups() == ('19.1', '19.2') + backport_to = core.IS_BACKPORT.findall(message) + assert backport_to == [('19.1', '19.2')] + + def test_multiple_release_lines(self): + """Tests commit with more than one branch specified in mulitple tags""" + message = textwrap.dedent("""\ + commit title + + Backport-to: 19.0 + Backport-to: 19.1, 19.2 + """) + + backport_to = core.IS_BACKPORT.findall(message) + assert backport_to == [('19.0', ''), ('19.1', '19.2')] class TestResolveNomination: