pick-ui: make Backport-to: 25.0 backport to 25.0 *and more recent release branches*
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

It is what developers expect, so make the code match it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34580>
This commit is contained in:
Eric Engestrom 2025-04-17 16:42:58 +02:00 committed by Marge Bot
parent 37e6a8b57f
commit c37a468a8a
3 changed files with 17 additions and 2 deletions

View file

@ -29,6 +29,7 @@ import subprocess
import typing import typing
import attr import attr
from packaging.version import Version
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from .ui import UI from .ui import UI
@ -294,7 +295,8 @@ async def resolve_nomination(commit: 'Commit', version: str) -> 'Commit':
if backport_to := IS_BACKPORT.findall(commit_message): if backport_to := IS_BACKPORT.findall(commit_message):
for match in backport_to: for match in backport_to:
if version in match: if any(Version(version) >= Version(backport_version)
for backport_version in match if backport_version != ''):
commit.nominated = True commit.nominated = True
commit.nomination_type = NominationType.BACKPORT commit.nomination_type = NominationType.BACKPORT
return commit return commit

View file

@ -405,6 +405,17 @@ class TestResolveNomination:
assert c.nominated assert c.nominated
assert c.nomination_type is core.NominationType.BACKPORT 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')
c = core.Commit('abcdef1234567890', 'a commit')
with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock):
await core.resolve_nomination(c, '16.3')
assert c.nominated
assert c.nomination_type is core.NominationType.BACKPORT
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_backport_is_not_nominated(self): async def test_backport_is_not_nominated(self):
s = self.FakeSubprocess(b'Backport-to: 16.2') s = self.FakeSubprocess(b'Backport-to: 16.2')

View file

@ -136,7 +136,9 @@ following example::
Backport-to: 21.0 Backport-to: 21.0
Multiple ``Backport-to:`` lines are allowed. 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.
The last option is deprecated and mostly here for historical reasons The last option is deprecated and mostly here for historical reasons
dating back to when patch submission was done via emails: using a ``Cc:`` dating back to when patch submission was done via emails: using a ``Cc:``