Commits

Anonymous committed df1194b

Add new replacement rules for use after hg migration.

Comments (0)

Files changed (1)

extensions/local_replace.py

      r'py3k/\g<path>">\g<sep>\g<path></a>'),
 ]
 
+# for use after hg migration
+
+'''
+substitutions = [
+    # r12345, r 12345, rev12345, rev 12345, revision12345, revision 12345
+    (re.compile(r'\b(?<![/?&;])(?P<revstr>r(ev(ision)?)?\s*)(?P<revision>\d+)'),
+     r'<a href="http://hg.python.org/lookup/r\g<revision>">\g<revstr>\g<revision></a>'),
+
+    # [deadbeef]  (syntax open for discussion)
+    (re.compile(r'\b(?<![/?&;])\[(?P<revision>[a-fA-F0-9]{6,})\]'),
+     r'<a href="http://hg.python.org/lookup/\g<revision>">[\g<revision>]</a>'),
+
+    # Lib/somefile.py, Modules/somemodule.c, Doc/somedocfile.rst, ...
+    (re.compile(r'(?P<sep>(?<!\w/)|(?<!\w)/)(?P<path>(?:Demo|Doc|Grammar|'
+                r'Include|Lib|Mac|Misc|Modules|Parser|PC|PCbuild|Python|'
+                'RISCOS|Tools|Objects)/[-.a-zA-Z0-9_/]+[a-zA-Z0-9]/?)'),
+     r'<a href="http://hg.python.org/cpython/file/py3k/\g<path>">\g<sep>\g<path></a>'),
+]
+'''
+
 
 # if the issue number is too big the db will explode -- limit it to 7 digits
 issue_re = re.compile(r'(?P<text>(\#|\b(?<!/)issue)\s*(?P<id>1?\d{1,6}))\b', re.I)