pick-ui: make Backport-to: 25.0
backport to 25.0 *and more recent release branches*
It is what developers expect, so make the code match it. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34580> (cherry picked from commit c37a468a8a109cbaece70760fd748fc838185b88)
This commit is contained in:

committed by
Eric Engestrom

parent
b072a973ee
commit
94628a8fbf
@@ -1704,7 +1704,7 @@
|
||||
"description": "pick-ui: make `Backport-to: 25.0` backport to 25.0 *and more recent release branches*",
|
||||
"nominated": false,
|
||||
"nomination_type": 0,
|
||||
"resolution": 4,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
@@ -29,6 +29,7 @@ import subprocess
|
||||
import typing
|
||||
|
||||
import attr
|
||||
from packaging.version import Version
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
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):
|
||||
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.nomination_type = NominationType.BACKPORT
|
||||
return commit
|
||||
|
@@ -405,6 +405,17 @@ class TestResolveNomination:
|
||||
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')
|
||||
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
|
||||
async def test_backport_is_not_nominated(self):
|
||||
s = self.FakeSubprocess(b'Backport-to: 16.2')
|
||||
|
@@ -136,7 +136,9 @@ following example::
|
||||
|
||||
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
|
||||
dating back to when patch submission was done via emails: using a ``Cc:``
|
||||
|
Reference in New Issue
Block a user