From 903ea73119a724b0c516412abb9cf8cb90b557f3 Mon Sep 17 00:00:00 2001 From: Nicolas Dossou-gbete Date: Mon, 10 Jul 2017 16:46:59 +0100 Subject: [PATCH] [activity.py] Identify Gerrit-style bug annotations in commit messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract bug numbers noted "Bug: 99999" in addition to the older "BUG=99999" style. Bug: None Change-Id: If29139ee2bae3c515748395a846e45ce6995d9ec Reviewed-on: https://chromium-review.googlesource.com/548718 Reviewed-by: Marc-Antoine Ruel Commit-Queue: Nicolas Dossou-Gbété --- my_activity.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/my_activity.py b/my_activity.py index f59a6a0c73..19b303b5b9 100755 --- a/my_activity.py +++ b/my_activity.py @@ -265,7 +265,10 @@ class MyActivity(object): bugs = [] if description: - matches = re.findall('BUG=(((\d+)(,\s?)?)+)', description) + # Handle both "Bug: 99999" and "BUG=99999" bug notations + # Multiple bugs can be noted on a single line or in multiple ones. + matches = re.findall(r'BUG[=:]\s?(((\d+)(,\s?)?)+)', description, + flags=re.IGNORECASE) if matches: for match in matches: bugs.extend(match[0].replace(' ', '').split(','))