diff --git a/.pick_status.json b/.pick_status.json index e63fb9b35ee..5599dd8ebb3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/bin/pick/core.py b/bin/pick/core.py index 7cf3496037a..3e1cd4c2c92 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -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(out): 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 diff --git a/bin/pick/core_test.py b/bin/pick/core_test.py index 0e58a668205..244db10efb5 100644 --- a/bin/pick/core_test.py +++ b/bin/pick/core_test.py @@ -395,6 +395,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') diff --git a/docs/submittingpatches.rst b/docs/submittingpatches.rst index b5346303773..d13bffe80fa 100644 --- a/docs/submittingpatches.rst +++ b/docs/submittingpatches.rst @@ -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:``