comparison mercurial/util.py @ 5215:b0bc8cf41ffc

merge with -stable
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 24 Aug 2007 00:39:16 +0200
parents 316ce5e85b3e 0f6a1bdf89fb
children 335696e2a58f 23651848d638
comparison
equal deleted inserted replaced
5214:316ce5e85b3e 5215:b0bc8cf41ffc
474 if not pats: 474 if not pats:
475 return 475 return
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:
482 re.compile('(?:%s)' % regex(k, p, tail)) 491 re.compile('(?:%s)' % regex(k, p, tail))
483 except re.error: 492 except re.error: