##// END OF EJS Templates
match: handle large regexes...
Matt Mackall -
r5201:0f6a1bdf default
parent child Browse files
Show More
@@ -476,6 +476,15 b' def _matcher(canonroot, cwd, names, inc,'
476 try:
476 try:
477 pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats])
477 pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats])
478 return re.compile(pat).match
478 return re.compile(pat).match
479 except OverflowError:
480 # We're using a Python with a tiny regex engine and we
481 # made it explode, so we'll divide the pattern list in two
482 # until it works
483 l = len(pats)
484 if l < 2:
485 raise
486 a, b = matchfn(pats[:l/2], tail), matchfn(pats[l/2:], tail)
487 return lambda s: a(s) or b(s)
479 except re.error:
488 except re.error:
480 for k, p in pats:
489 for k, p in pats:
481 try:
490 try:
General Comments 0
You need to be logged in to leave comments. Login now