From b2d99b93780a047356603ae8058f88e349d1bfde Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 18 Apr 2025 00:43:03 +0200 Subject: [PATCH] pick-ui: add `Backport-to: *` as a synonym to `Cc: mesa-stable` Part-of: --- bin/pick/core.py | 4 ++-- bin/pick/core_test.py | 19 +++++++++++++++---- docs/submittingpatches.rst | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/bin/pick/core.py b/bin/pick/core.py index 8fa1098dacc..33156ed9a4a 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -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*\ '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 diff --git a/bin/pick/core_test.py b/bin/pick/core_test.py index 53b89f2c0bd..dee3c7c1701 100644 --- a/bin/pick/core_test.py +++ b/bin/pick/core_test.py @@ -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') diff --git a/docs/submittingpatches.rst b/docs/submittingpatches.rst index 19fb7b06dac..2f3c0f06d8f 100644 --- a/docs/submittingpatches.rst +++ b/docs/submittingpatches.rst @@ -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:``