summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>2022-12-08 23:09:26 +0300
committerKonstantin Kharlamov <Hi-Angel@yandex.ru>2022-12-30 03:39:38 +0300
commit52cd87ea16f05fc3cc87be9315cd2d2e6dc9850d (patch)
tree7dd385d092f0a8816cd0e8241391066e69d33bc3
parent334123a908cfac282297ba5240aecac79e9babd2 (diff)
downloadmesa-52cd87ea16f05fc3cc87be9315cd2d2e6dc9850d.tar.gz
bin/gen_release_notes.py: don't fail if "Closes" refers to an MR
Sometimes a tag "Closes:" in a commit may refer to a merge request instead of an issue. Examples of such commits: 34319c7d84 "ci/freedreno: disable antichambers trace" 998122d9c2 "mesa: fix GL_INVALID_OPERATION in glEGLImageTargetTexStorageEXT" Avoid failing on these by explicitly checking that the URL refers to an issue Cc: mesa-stable Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20241>
-rwxr-xr-xbin/gen_release_notes.py6
-rw-r--r--bin/gen_release_notes_test.py16
2 files changed, 21 insertions, 1 deletions
diff --git a/bin/gen_release_notes.py b/bin/gen_release_notes.py
index 889c0a43654..b7651d2935e 100755
--- a/bin/gen_release_notes.py
+++ b/bin/gen_release_notes.py
@@ -195,7 +195,11 @@ async def parse_issues(commits: str) -> typing.List[str]:
for line in reversed(out):
if line.startswith('Closes:'):
bug = line.lstrip('Closes:').strip()
- if bug.startswith('https://gitlab.freedesktop.org/mesa/mesa'):
+ if (bug.startswith('https://gitlab.freedesktop.org/mesa/mesa')
+ # Avoid parsing "merge_requests" URL. Note that a valid issue
+ # URL may or may not contain the "/-/" text, so we check if
+ # the word "issues" is contained in URL.
+ and '/issues' in bug):
# This means we have a bug in the form "Closes: https://..."
issues.append(os.path.basename(urllib.parse.urlparse(bug).path))
elif ',' in bug:
diff --git a/bin/gen_release_notes_test.py b/bin/gen_release_notes_test.py
index 114b99469fe..b8a5e386f3e 100644
--- a/bin/gen_release_notes_test.py
+++ b/bin/gen_release_notes_test.py
@@ -148,6 +148,22 @@ async def test_gather_commits():
''',
['3456', '3457', '3458'],
),
+ (
+ '''\
+ Without /-/
+
+ Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/36
+ ''',
+ ['36'],
+ ),
+ (
+ '''\
+ Ignore merge_requests
+
+ Closes: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20241
+ ''',
+ [],
+ ),
])
async def test_parse_issues(content: str, bugs: typing.List[str]) -> None:
mock_com = mock.AsyncMock(return_value=(textwrap.dedent(content).encode(), ''))