Mesa (staging/21.2): bin/gen_release_notes: Fix commits with multiple Closes:
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Aug 5 16:27:37 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: a96c2c5d7af7f2abded681b26863b7638e8b6b8d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a96c2c5d7af7f2abded681b26863b7638e8b6b8d
Author: Dylan Baker <dylan.c.baker at intel.com>
Date: Wed Aug 4 11:37:12 2021 -0700
bin/gen_release_notes: Fix commits with multiple Closes:
Currently we'd only handle the last one, not all of them. Which is
clearely not correct.
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12201>
(cherry picked from commit da00a11bf28f9b9898efa1e6184fa27ea8277a94)
---
.pick_status.json | 2 +-
bin/gen_release_notes.py | 16 +++++++---------
bin/gen_release_notes_test.py | 33 ++++++++++++++++++++++++++++++++-
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 52cb671722d..7fc9897d95a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -103,7 +103,7 @@
"description": "bin/gen_release_notes: Fix commits with multiple Closes:",
"nominated": false,
"nomination_type": null,
- "resolution": 4,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/bin/gen_release_notes.py b/bin/gen_release_notes.py
index bfc65ca92b7..9b14c908bb5 100755
--- a/bin/gen_release_notes.py
+++ b/bin/gen_release_notes.py
@@ -195,15 +195,13 @@ async def parse_issues(commits: str) -> typing.List[str]:
for line in reversed(out):
if line.startswith('Closes:'):
bug = line.lstrip('Closes:').strip()
- break
- else:
- raise Exception('No closes found?')
-
- if bug.startswith('https://gitlab.freedesktop.org/mesa/mesa'):
- # This means we have a bug in the form "Closes: https://..."
- issues.append(os.path.basename(urllib.parse.urlparse(bug).path))
- elif bug.startswith('#'):
- issues.append(bug.lstrip('#'))
+ if bug.startswith('https://gitlab.freedesktop.org/mesa/mesa'):
+ # This means we have a bug in the form "Closes: https://..."
+ issues.append(os.path.basename(urllib.parse.urlparse(bug).path))
+ elif ',' in bug:
+ issues.extend([b.strip().lstrip('#') for b in bug.split(',')])
+ elif bug.startswith('#'):
+ issues.append(bug.lstrip('#'))
return issues
diff --git a/bin/gen_release_notes_test.py b/bin/gen_release_notes_test.py
index 194fbc745ac..114b99469fe 100644
--- a/bin/gen_release_notes_test.py
+++ b/bin/gen_release_notes_test.py
@@ -117,6 +117,37 @@ async def test_gather_commits():
''',
[],
),
+
+ # Test multiple issues on one line
+ (
+ '''\
+ Fix many bugs
+
+ Closes: #1, #2
+ ''',
+ ['1', '2'],
+ ),
+
+ # Test multiple closes
+ (
+ '''\
+ Fix many bugs
+
+ Closes: #1
+ Closes: #2
+ ''',
+ ['1', '2'],
+ ),
+ (
+ '''\
+ With long form
+
+ Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3456
+ Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3457
+ Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3458
+ ''',
+ ['3456', '3457', '3458'],
+ ),
])
async def test_parse_issues(content: str, bugs: typing.List[str]) -> None:
mock_com = mock.AsyncMock(return_value=(textwrap.dedent(content).encode(), ''))
@@ -127,4 +158,4 @@ async def test_parse_issues(content: str, bugs: typing.List[str]) -> None:
with mock.patch('bin.gen_release_notes.asyncio.create_subprocess_exec', mock_exec), \
mock.patch('bin.gen_release_notes.gather_commits', mock.AsyncMock(return_value='sha\n')):
ids = await parse_issues('1234 not used')
- assert ids == bugs
+ assert set(ids) == set(bugs)
More information about the mesa-commit
mailing list