diff -r 87882c8753d4 -r 8d08a28aa63e mercurial/match.py --- a/mercurial/match.py Thu Jun 07 01:42:50 2012 +0200 +++ b/mercurial/match.py Fri Jun 01 15:26:20 2012 -0700 @@ -9,6 +9,14 @@ import scmutil, util, fileset from i18n import _ +def _rematcher(pat): + m = util.compilere(pat) + try: + # slightly faster, provided by facebook's re2 bindings + return m.test_match + except AttributeError: + return m.match + def _expandsets(pats, ctx): '''convert set: patterns into a list of files in the given context''' fset = set() @@ -280,7 +288,7 @@ pat = '(?:%s)' % '|'.join([_regex(k, p, tail) for (k, p) in pats]) if len(pat) > 20000: raise OverflowError - return pat, re.compile(pat).match + return pat, _rematcher(pat) except OverflowError: # We're using a Python with a tiny regex engine and we # made it explode, so we'll divide the pattern list in two @@ -294,7 +302,7 @@ except re.error: for k, p in pats: try: - re.compile('(?:%s)' % _regex(k, p, tail)) + _rematcher('(?:%s)' % _regex(k, p, tail)) except re.error: raise util.Abort(_("invalid pattern (%s): %s") % (k, p)) raise util.Abort(_("invalid pattern"))