[Python-checkins] r82217 - tracker/instances/python-dev/extensions/local_replace.py
ezio.melotti
python-checkins at python.org
Fri Jun 25 18:18:36 CEST 2010
Author: ezio.melotti
Date: Fri Jun 25 18:18:36 2010
New Revision: 82217
Log:
Refactor the regex list, use one regex for [r,rev,revision], add comments, indent properly, avoid long lines.
Modified:
tracker/instances/python-dev/extensions/local_replace.py
Modified: tracker/instances/python-dev/extensions/local_replace.py
==============================================================================
--- tracker/instances/python-dev/extensions/local_replace.py (original)
+++ tracker/instances/python-dev/extensions/local_replace.py Fri Jun 25 18:18:36 2010
@@ -1,16 +1,17 @@
import re
-substitutions = [ (re.compile(r'\#(?P<ws>\s*)(?P<id>\d+)'),
- r'<a href="issue\g<id>">#\g<ws>\g<id></a>'),
- (re.compile(r'\brevision(?P<ws>\s*)(?P<revision>\d+)'),
- r'<a href="http://svn.python.org/view?rev=\g<revision>&view=rev">revision\g<ws>\g<revision></a>'),
- (re.compile(r'\brev(?P<ws>\s*)(?P<revision>\d+)'),
- r'<a href="http://svn.python.org/view?rev=\g<revision>&view=rev">rev\g<ws>\g<revision></a>'),
- (re.compile(r'\b(?P<revstr>r|r\s+)(?P<revision>\d+)'),
- r'<a href="http://svn.python.org/view?rev=\g<revision>&view=rev">\g<revstr>\g<revision></a>'),
- (re.compile(r'\b(?P<path>(?:Demo|Doc|Grammar|Include|Lib|Mac|Misc|Modules|Parser|PC|PCbuild|Python|RISCOS|Tools|Objects)/[-.a-zA-Z0-9_/]+[a-zA-Z0-9]/?)'),
- r'<a href="http://svn.python.org/view/python/trunk/\g<path>">\g<path></a>'),
- ]
+substitutions = [
+ # #1234, # 1234
+ (re.compile(r'\#(?P<ws>\s*)(?P<id>\d+)'),
+ r'<a href="issue\g<id>">#\g<ws>\g<id></a>'),
+ # 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://svn.python.org/view?rev=\g<revision>&view=rev">\g<revstr>\g<revision></a>'),
+ # Lib/somefile.py, Modules/somemodule.c, Doc/somedocfile.rst, ...
+ (re.compile(r'\b(?P<path>(?:Demo|Doc|Grammar|Include|Lib|Mac|Misc|Modules|Parser|PC|'
+ r'PCbuild|Python|RISCOS|Tools|Objects)/[-.a-zA-Z0-9_/]+[a-zA-Z0-9]/?)'),
+ r'<a href="http://svn.python.org/view/python/trunk/\g<path>">\g<path></a>'),
+]
def localReplace(message):
"""
More information about the Python-checkins
mailing list