From patchwork Mon Jul 1 04:52:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,1,4test] util: check if re2 works before using it (issue 3964) From: Simon Heimberg X-Patchwork-Id: 1772 Message-Id: <9c97c44192062eea19b9.1372654336@lapsi.heimberg.home> To: Mercurial-devel Date: Mon, 01 Jul 2013 06:52:16 +0200 # HG changeset patch # User Simon Heimberg # Date 1372654258 -7200 # Node ID 9c97c44192062eea19b956c5d9697a4790ceee2b # Parent 77440de177f799f9f3bd6236c5b45fb8e15687e7 util: check if re2 works before using it (issue 3964) diff -r 77440de177f7 -r 9c97c4419206 mercurial/util.py --- a/mercurial/util.py Mit Jun 26 23:12:55 2013 +0200 +++ 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 + _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]')) + # check if match works, see issue3964 except ImportError: _re2 = False if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0: