|
1 | 1 | import re |
2 | 2 |
|
3 | | -substitutions = [ (re.compile('debian:\#(?P<id>\d+)'), |
4 | | - '<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\g<id>">debian#\g<id></a>' ), |
5 | | - (re.compile('\#(?P<ws>\s*)(?P<id>\d+)'), |
6 | | - "<a href='issue\g<id>'>#\g<ws>\g<id></a>" ), |
7 | | - (re.compile('(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'), |
8 | | - "\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ), |
| 3 | +substitutions = [ (re.compile(r'debian:\#(?P<id>\d+)'), |
| 4 | + r'<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\g<id>">debian#\g<id></a>' ), |
| 5 | + (re.compile(r'\#(?P<ws>\s*)(?P<id>\d+)'), |
| 6 | + r"<a href='issue\g<id>'>#\g<ws>\g<id></a>" ), |
| 7 | + (re.compile(r'(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'), |
| 8 | + r"\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ), |
9 | 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+|$)'), |
11 | | - "\g<prews><a href='http://sourceforge.net/p/roundup/code/ci/\g<revision>'>\g<revstr>\g<revision></a>\g<post>"), |
| 10 | + (re.compile(r'(?P<prews>^|\s+)(?P<revstr>(revision|rev|r)\s?)(?P<revision>([1-9][0-9]*)|[0-9a-fA-F]{4,40})(?P<post>\W+|$)'), |
| 11 | + r"\g<prews><a href='http://sourceforge.net/p/roundup/code/ci/\g<revision>'>\g<revstr>\g<revision></a>\g<post>"), |
12 | 12 | ] |
13 | 13 |
|
14 | 14 | def local_replace(message): |
@@ -40,7 +40,7 @@ def quicktest(msgstr, should_replace = True): |
40 | 40 | quicktest("re-evaluate", False) |
41 | 41 | quicktest("rex140eb", False) |
42 | 42 | quicktest("rev 012", False) # too short for a hg hash |
43 | | - quicktest("rev 0123", False) # too short for a hg hash |
| 43 | + quicktest("rev 0123") |
44 | 44 | quicktest("re140eb") |
45 | 45 | quicktest(" r7140eb") |
46 | 46 | quicktest(" rev7140eb ") |
|
0 commit comments