bin/gen_release_notes: Don't consider issues for other projects

We have enough commits in mesa that have external dependencies that we
need to be sure that a Closes: https://... is actually for mesa and not
for another project.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12201>
This commit is contained in:
Dylan Baker 2021-08-04 11:32:19 -07:00 committed by Marge Bot
parent 9dc3672b00
commit 30f7b55e47
2 changed files with 25 additions and 2 deletions

View File

@ -198,10 +198,11 @@ async def parse_issues(commits: str) -> typing.List[str]:
break break
else: else:
raise Exception('No closes found?') raise Exception('No closes found?')
if bug.startswith('h'):
if bug.startswith('https://gitlab.freedesktop.org/mesa/mesa'):
# This means we have a bug in the form "Closes: https://..." # This means we have a bug in the form "Closes: https://..."
issues.append(os.path.basename(urllib.parse.urlparse(bug).path)) issues.append(os.path.basename(urllib.parse.urlparse(bug).path))
else: elif bug.startswith('#'):
issues.append(bug.lstrip('#')) issues.append(bug.lstrip('#'))
return issues return issues

View File

@ -77,6 +77,8 @@ async def test_gather_commits():
[ [
# It is important to have the title on a new line, as # It is important to have the title on a new line, as
# textwrap.dedent wont work otherwise. # textwrap.dedent wont work otherwise.
# Test the `Closes: #N` syntax
( (
'''\ '''\
A commit A commit
@ -87,6 +89,8 @@ async def test_gather_commits():
''', ''',
['1'], ['1'],
), ),
# Test the Full url
( (
'''\ '''\
A commit with no body A commit with no body
@ -95,6 +99,24 @@ async def test_gather_commits():
''', ''',
['3456'], ['3456'],
), ),
# Test projects that are not mesa
(
'''\
A commit for libdrm
Closes: https://gitlab.freedesktop.org/mesa/drm/-/3456
''',
[],
),
(
'''\
A commit for for something else completely
Closes: https://github.com/Organiztion/project/1234
''',
[],
),
]) ])
async def test_parse_issues(content: str, bugs: typing.List[str]) -> None: async def test_parse_issues(content: str, bugs: typing.List[str]) -> None:
mock_com = mock.AsyncMock(return_value=(textwrap.dedent(content).encode(), '')) mock_com = mock.AsyncMock(return_value=(textwrap.dedent(content).encode(), ''))