From 44eb32f68ddd2395763df741c1a3bece963e5e9e Mon Sep 17 00:00:00 2001 From: Alaska Date: Fri, 11 Apr 2025 10:58:24 +0200 Subject: [PATCH] Release note tools: Only check for issue numbers if they contain a space before them In the bug fixes per release tool, we got a list of bug reports that were fixed by a commit using a regular expression that pulled the number from `#NUMBER`. However in specific situations, this resulted in the retrieval of the wrong issue numbers, and ultimately a mis-classification of a fix commit. For example 778b1efd84 contains `Fixes blender/blender-manual#NUMBER` We were extracting the NUMBER from this and treating it as if it was a bug report for the `blender/blender` repository, which means it points to the wrong bug report. This commit fixes this issue by taking a simple approach of only checking for report numbers that match the format: `SPACE#NUMBER`, which will eliminate cases like `blender/blender-manual#NUMBER`. Pull Request: https://projects.blender.org/blender/blender/pulls/136744 --- release/release_notes/bug_fixes_per_major_release.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/release/release_notes/bug_fixes_per_major_release.py b/release/release_notes/bug_fixes_per_major_release.py index 6ecee02445a..4c618fe2d22 100644 --- a/release/release_notes/bug_fixes_per_major_release.py +++ b/release/release_notes/bug_fixes_per_major_release.py @@ -312,8 +312,10 @@ class CommitInfo: command = ['git', 'show', '-s', '--format=%B', self.hash] command_output = subprocess.run(command, capture_output=True).stdout.decode('utf-8') - # Find every instance of #NUMBER. These are the report that the commit claims to fix. - match = re.findall(r'#(\d+)', command_output) + # Find every instance of SPACE#NUMBER. These are the report that the commit claims to fix. + # We are looking for the SPACE part because otherwise commits that fix issues in other repos, + # E.g. Fix blender/blender-maunal#NUMBER, will be picked out for processing. + match = re.findall(r'\s#+(\d+)', command_output) if match: self.fixed_reports = match