summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDylan Baker <dylan.c.baker@intel.com>2021-08-04 11:37:12 -0700
committerMarge Bot <eric+marge@anholt.net>2021-08-04 23:03:57 +0000
commitda00a11bf28f9b9898efa1e6184fa27ea8277a94 (patch)
tree12139ffd7e0eca485ac7f8648392f6577a339fb9 /bin
parent30f7b55e475965d31585bbfb0bd03f234cda16b0 (diff)
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@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12201>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gen_release_notes.py16
-rw-r--r--bin/gen_release_notes_test.py33
2 files changed, 39 insertions, 10 deletions
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)