changeset 19461:dd7c992d3cc1

util: check if re2 works before using it (issue 3964)
author Simon Heimberg <simohe@besonet.ch>
date Mon, 01 Jul 2013 06:50:58 +0200
parents d876c82f25a3
children a87d9102f7af
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Thu Jul 18 23:22:59 2013 -0500
+++ b/mercurial/util.py	Mon Jul 01 06:50:58 2013 +0200
@@ -673,8 +673,8 @@
     global _re2
     if _re2 is None:
         try:
-            re2.compile
-            _re2 = True
+            # check if match works, see issue3964
+            _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]'))
         except ImportError:
             _re2 = False
     if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0: