1
0
Fork 0
mirror of https://gitlab.wikimedia.org/ladsgroup/Phabricator-maintenance-bot synced 2024-11-25 13:32:38 +01:00

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".
This commit is contained in:
Ahmon Dancy 2023-01-19 10:57:12 -08:00
parent 9b64c4b501
commit 10c6aace45

View file

@ -51,7 +51,7 @@ class Checker():
return False return False
raw_comment = case['comments'][0]['content']['raw'] raw_comment = case['comments'][0]['content']['raw']
gerrit_patch_id = re.findall( 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( merged = re.findall(
r'Change \d+ \*\*(?:merged|abandoned)\*\* by ', r'Change \d+ \*\*(?:merged|abandoned)\*\* by ',
raw_comment) raw_comment)