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

Simon Heimberg simohe at besonet.ch
Wed Jun 12 18:34:51 CDT 2013


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

This gives some speed gain when re2 is installed.

diff -r bc083daefc5b -r a5e7c7c37107 contrib/check-code.py
--- a/contrib/check-code.py	Don Jun 13 01:25:24 2013 +0200
+++ b/contrib/check-code.py	Don Jun 13 01:25:59 2013 +0200
@@ -347,10 +347,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