Skip to content

Commit 559f8c7

Browse files
website: local_replace.py: now explicitely match hashes with hex characters only if they are at least 4 chars long.
1 parent 7f33297 commit 559f8c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

website/issues/extensions/local_replace.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"<a href='issue\g<id>'>#\g<ws>\g<id></a>" ),
77
(re.compile('(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'),
88
"\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ),
9-
(re.compile('(?P<prews>^|\s+)(?P<revstr>(revision|rev|r)\s?)(?P<revision>[1-9a-fA-F][0-9a-fA-F]*)(?P<post>\W+|$)'),
9+
# matching hg revison number or hash
10+
(re.compile('(?P<prews>^|\s+)(?P<revstr>(revision|rev|r)\s?)(?P<revision>([1-9][0-9]*)|[0-9a-fA-F]{4,40})(?P<post>\W+|$)'),
1011
"\g<prews><a href='http://sourceforge.net/p/roundup/code/ci/\g<revision>'>\g<revstr>\g<revision></a>\g<post>"),
1112
]
1213

@@ -38,6 +39,8 @@ def quicktest(msgstr, should_replace = True):
3839
quicktest(" too many spaces r 222", False)
3940
quicktest("re-evaluate", False)
4041
quicktest("rex140eb", False)
42+
quicktest("rev 012", False) # too short for a hg hash
43+
quicktest("rev 0123", False) # too short for a hg hash
4144
quicktest("re140eb")
4245
quicktest(" r7140eb")
4346
quicktest(" rev7140eb ")

0 commit comments

Comments
 (0)