pick-ui: fix parsing of multiple backport-to: lines
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34117>
This commit is contained in:
Eric Engestrom 2025-03-21 12:26:20 +01:00 committed by Marge Bot
parent f8d07396fa
commit e7b2eda39d
2 changed files with 24 additions and 14 deletions

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(commit_message):
if version in backport_to.groups():
commit.nominated = True
commit.nomination_type = NominationType.BACKPORT
return commit
if backport_to := IS_BACKPORT.findall(commit_message):
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(commit_message):
if cc_to.groups() == (None, None) or version in cc_to.groups():

View file

@ -262,9 +262,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"""
@ -278,9 +277,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"""
@ -294,9 +292,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: