pick-ui: fix parsing of multiple backport-to: lines

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34117>
(cherry picked from commit e7b2eda39d)
This commit is contained in:
Eric Engestrom 2025-03-21 12:26:20 +01:00 committed by Eric Engestrom
parent 6b31b441f9
commit a423142482
3 changed files with 25 additions and 15 deletions

View file

@ -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

View file

@ -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():

View file

@ -252,9 +252,8 @@ class TestRE:
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
""")
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 <pierre-eric.pelloux-prayer@amd.com>
""")
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 <pierre-eric.pelloux-prayer@amd.com>
""")
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: