pick-ui: add Backport-to: * as a synonym to Cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34598>
This commit is contained in:
Eric Engestrom 2025-04-18 00:43:03 +02:00 committed by Marge Bot
parent 5ae89dbf48
commit b2d99b9378
3 changed files with 20 additions and 6 deletions

View file

@ -52,7 +52,7 @@ IS_FIX = re.compile(r'^\s*fixes:\s*([a-f0-9]{6,40})', flags=re.MULTILINE | re.IG
IS_CC = re.compile(r'^\s*cc:\s*["\']?([0-9]{2}\.[0-9])?["\']?\s*["\']?([0-9]{2}\.[0-9])?["\']?\s*\<?mesa-stable',
flags=re.MULTILINE | re.IGNORECASE)
IS_REVERT = re.compile(r'This reverts commit ([0-9a-f]{40})')
IS_BACKPORT = re.compile(r'^\s*backport-to:\s*(\d{2}\.\d),?\s*(\d{2}\.\d)?',
IS_BACKPORT = re.compile(r'^\s*backport-to:\s*(?:(\d{2}\.\d),?\s*(\d{2}\.\d)?|(\*))',
flags=re.MULTILINE | re.IGNORECASE)
# XXX: hack
@ -295,7 +295,7 @@ async def resolve_nomination(commit: 'Commit', version: str) -> 'Commit':
if backport_to := IS_BACKPORT.findall(commit_message):
for match in backport_to:
if any(Version(version) >= Version(backport_version)
if any(backport_version == '*' or Version(version) >= Version(backport_version)
for backport_version in match if backport_version != ''):
commit.nominated = True
commit.nomination_type = NominationType.BACKPORT

View file

@ -263,7 +263,7 @@ class TestRE:
""")
backport_to = core.IS_BACKPORT.findall(message)
assert backport_to == [('19.2', '')]
assert backport_to == [('19.2', '', '')]
def test_multiple_release_space(self):
"""Tests commit with more than one branch specified"""
@ -278,7 +278,7 @@ class TestRE:
""")
backport_to = core.IS_BACKPORT.findall(message)
assert backport_to == [('19.1', '19.2')]
assert backport_to == [('19.1', '19.2', '')]
def test_multiple_release_comma(self):
"""Tests commit with more than one branch specified"""
@ -293,7 +293,7 @@ class TestRE:
""")
backport_to = core.IS_BACKPORT.findall(message)
assert backport_to == [('19.1', '19.2')]
assert backport_to == [('19.1', '19.2', '')]
def test_multiple_release_lines(self):
"""Tests commit with more than one branch specified in mulitple tags"""
@ -305,7 +305,7 @@ class TestRE:
""")
backport_to = core.IS_BACKPORT.findall(message)
assert backport_to == [('19.0', ''), ('19.1', '19.2')]
assert backport_to == [('19.0', '', ''), ('19.1', '19.2', '')]
class TestResolveNomination:
@ -405,6 +405,17 @@ class TestResolveNomination:
assert c.nominated
assert c.nomination_type is core.NominationType.BACKPORT
@pytest.mark.asyncio
async def test_backport_all_is_nominated(self):
s = self.FakeSubprocess(b'Backport-to: *')
c = core.Commit('abcdef1234567890', 'a commit')
with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock):
await core.resolve_nomination(c, '0.0')
assert c.nominated
assert c.nomination_type is core.NominationType.BACKPORT
@pytest.mark.asyncio
async def test_backport_is_nominated_after(self):
s = self.FakeSubprocess(b'Backport-to: 16.2')

View file

@ -197,6 +197,9 @@ following example::
This will backport the commit to the 21.0 branch, as well as any more recent
stable branch. Multiple ``Backport-to:`` lines are allowed, but only the
lowest number mentioned actually matters, so for clarity, please only use one.
You can also use the special ``Backport-to: *`` which will nominate the commit
to be backported to every active stable branch, making it a synonym to the ``Cc:
mesa-stable`` below.
The last option is deprecated and mostly here for historical reasons
dating back to when patch submission was done via emails: using a ``Cc:``