comparison mercurial/util.py @ 46521:ebc6d3484fdd stable

re2: byteify some regex used to get check re2 availability Changeset 687b865b95ad failed to properly byteify this because it was a raw string. This went undetected so far because re2 does not seems to be widely tested. Differential Revision: https://phab.mercurial-scm.org/D10064
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 24 Feb 2021 15:16:22 +0100
parents 59fa3890d40a
children 6f4a481f182a 112826b59476
comparison
equal deleted inserted replaced
46493:b910be772eb9 46521:ebc6d3484fdd
2168 class _re(object): 2168 class _re(object):
2169 def _checkre2(self): 2169 def _checkre2(self):
2170 global _re2 2170 global _re2
2171 try: 2171 try:
2172 # check if match works, see issue3964 2172 # check if match works, see issue3964
2173 _re2 = bool(re2.match(r'\[([^\[]+)\]', b'[ui]')) 2173 _re2 = bool(re2.match(br'\[([^\[]+)\]', b'[ui]'))
2174 except ImportError: 2174 except ImportError:
2175 _re2 = False 2175 _re2 = False
2176 2176
2177 def compile(self, pat, flags=0): 2177 def compile(self, pat, flags=0):
2178 """Compile a regular expression, using re2 if possible 2178 """Compile a regular expression, using re2 if possible