Brett C. added the comment:

Here is the patch with tests (not actually run, though, since I don't have the 
DB setup).

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue610>
_______________________________________________________
diff -r 1b16b4c8ab77 extensions/local_replace.py
--- a/extensions/local_replace.py       Fri Dec 02 01:21:29 2016 +0200
+++ b/extensions/local_replace.py       Sat Dec 24 09:32:31 2016 -0800
@@ -74,10 +74,11 @@
 
 seps = r'\b(?<![-/?&;=_])'  # these chars should not precede the targets
 substitutions = [
-    # deadbeeffeed  (hashes with exactly twelve or forty chars)
-    (re.compile(r'%s(?P<revision>[a-fA-F0-9]{40})\b' % seps),
+    # deadbeeffeed  (hg hashes with exactly twelve or forty chars,
+    # git has 10 or more as it grows as time goes on)
+    (re.compile(r'%s(?P<revision>(git|hg)?[a-fA-F0-9]{40})\b' % seps),
      r'<a href="http://hg.python.org/lookup/\g<revision>">\g<revision></a>'),
-    (re.compile(r'%s(?P<revision>[a-fA-F0-9]{12})\b' % seps),
+    (re.compile(r'%s(?P<revision>(git|hg)?[a-fA-F0-9]{10,12})\b' % seps),
      r'<a href="http://hg.python.org/lookup/\g<revision>">\g<revision></a>'),
 
     # r12345, r 12345, rev12345, rev. 12345, revision12345, revision 12345
diff -r 1b16b4c8ab77 extensions/test/local_replace_data.txt
--- a/extensions/test/local_replace_data.txt    Fri Dec 02 01:21:29 2016 +0200
+++ b/extensions/test/local_replace_data.txt    Sat Dec 24 09:32:31 2016 -0800
@@ -28,6 +28,28 @@
 ## hg revisions
 
http://code.google.com/p/spyderlib/source/detail?spec=svne5d86b685619a470d593aa5f9ee360ba60779bc1&r=323c6c697f045166e384cdc15803d40eebed0a2b
 <a 
href="http://code.google.com/p/spyderlib/source/detail?spec=svne5d86b685619a470d593aa5f9ee360ba60779bc1&amp;r=323c6c697f045166e384cdc15803d40eebed0a2b";>http://code.google.com/p/spyderlib/source/detail?spec=svne5d86b685619a470d593aa5f9ee360ba60779bc1&amp;r=323c6c697f045166e384cdc15803d40eebed0a2b</a>
+41a99a2a7198
+<a href="http://hg.python.org/lookup/41a99a2a7198";>41a99a2a7198</a>
+hg41a99a2a7198
+<a href="http://hg.python.org/lookup/hg41a99a2a7198";>hg41a99a2a7198</a>
+41a99a2a7198e85c21643a5f1fdb598f07f11f9d
+<a 
href="http://hg.python.org/lookup/41a99a2a7198e85c21643a5f1fdb598f07f11f9d";>41a99a2a7198e85c21643a5f1fdb598f07f11f9d</a>
+hg41a99a2a7198e85c21643a5f1fdb598f07f11f9d
+<a 
href="http://hg.python.org/lookup/hg41a99a2a7198e85c21643a5f1fdb598f07f11f9d";>hg41a99a2a7198e85c21643a5f1fdb598f07f11f9d</a>
+##
+## git revisions
+4581b90a75
+<a href="http://hg.python.org/lookup/4581b90a75";>4581b90a75</a>
+git4581b90a75
+<a href="http://hg.python.org/lookup/git4581b90a75";>git4581b90a75</a>
+4581b90a75f
+<a href="http://hg.python.org/lookup/4581b90a75f";>4581b90a75f</a>
+git4581b90a75f
+<a href="http://hg.python.org/lookup/git4581b90a75f";>git4581b90a75f</a>
+4581b90a75f185df5f94af476cfc7e778fd11a24
+<a 
href="http://hg.python.org/lookup/4581b90a75f185df5f94af476cfc7e778fd11a24";>4581b90a75f185df5f94af476cfc7e778fd11a24</a>
+git4581b90a75f185df5f94af476cfc7e778fd11a24
+<a 
href="http://hg.python.org/lookup/git4581b90a75f185df5f94af476cfc7e778fd11a24";>git4581b90a75f185df5f94af476cfc7e778fd11a24</a>
 ##
 ## issues - the lowest issue id on bugs.python.org is #1000, the highest is 
#1779871
  #1
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to