From 10c6aace455d38bd35c44fdbae1750c14c537154 Mon Sep 17 00:00:00 2001 From: Ahmon Dancy Date: Thu, 19 Jan 2023 10:57:12 -0800 Subject: [PATCH] Fix gerrit_patch_id regexp Change the gerrit_patch_id regexp from r'https://gerrit(?:-test|)\.wikimedia\.org/r/.*(\d+)(?:$|\]\])' to r'https://gerrit(?:-test|)\.wikimedia\.org/r/(\d+)(?:$|\]\])' The .* in the old regexp was collecting most of the digits expected to be matched by the (\d+). For example if the input was https://gerrit.wikimedia.org/r/875932, the collected digits would just be "2". --- patchforreview_remover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchforreview_remover.py b/patchforreview_remover.py index 7d7bb62..52f5d28 100755 --- a/patchforreview_remover.py +++ b/patchforreview_remover.py @@ -51,7 +51,7 @@ class Checker(): return False raw_comment = case['comments'][0]['content']['raw'] gerrit_patch_id = re.findall( - r'https://gerrit(?:-test|)\.wikimedia\.org/r/.*(\d+)(?:$|\]\])', raw_comment)[0] + r'https://gerrit(?:-test|)\.wikimedia\.org/r/(\d+)(?:$|\]\])', raw_comment)[0] merged = re.findall( r'Change \d+ \*\*(?:merged|abandoned)\*\* by ', raw_comment)