From 63894a5d00a0b001ce8379ec4bff2fcb8f8f1929 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 11 2018 14:32:08 +0000 Subject: Adjust the FIXES regex so they cover project having a dash in their name Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/link.py b/pagure/lib/link.py index d25a425..04ca77b 100644 --- a/pagure/lib/link.py +++ b/pagure/lib/link.py @@ -20,15 +20,15 @@ import pagure.exceptions FIXES = [ re.compile(r'(?:.*\s+)?fixe?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?fixe?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?fixe?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), re.compile(r'(?:.*\s+)?merge?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?merge?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?merge?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), re.compile(r'(?:.*\s+)?close?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?close?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?close?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), ] diff --git a/tests/test_pagure_lib_link.py b/tests/test_pagure_lib_link.py index 14aa418..b6ec4fa 100644 --- a/tests/test_pagure_lib_link.py +++ b/tests/test_pagure_lib_link.py @@ -260,6 +260,8 @@ class PagureLibLinktests(tests.Modeltests): ('test', '123')) project_match('Merge: http://localhost/fork/pingou/test/issue/1234#foo', ('test', '1234')) + project_match('Merges: https://localhost/SSSD/ding-libs/pull-request/3188', + ('ding-libs', '3188')) # issue matches def issue_match(text, issue):