[PATCH 5 of 5] check-code: use new function for compiling regexp patterns

Simon Heimberg simohe at besonet.ch
Sat Jun 8 13:57:03 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1370715614 -7200
# Node ID 6f047263d6db2ac50b79a69d9bbb3379ccaf63b3
# Parent  e12f745ed2b4c38ac0acb2c8f7c2cebe3b130f3f
check-code: use new function for compiling regexp patterns

This gives some speed gain when re2 is installed.

diff -r e12f745ed2b4 -r 6f047263d6db contrib/check-code.py
--- a/contrib/check-code.py	Sam Jun 08 20:20:14 2013 +0200
+++ b/contrib/check-code.py	Sam Jun 08 20:20:14 2013 +0200
@@ -344,10 +344,10 @@
                 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
 
                 #print po, '=>', p
-                pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
+                pats[i] = (compilere(p, multiline=True),) + pseq[1:]
         filters = c[2]
         for i, flt in enumerate(filters):
-            filters[i] = re.compile(flt[0]), flt[1]
+            filters[i] = compilere(flt[0]), flt[1]
 _preparepats()
 
 class norepeatlogger(object):


More information about the Mercurial-devel mailing list