mercurial/util.py
changeset 5215 b0bc8cf41ffc
parent 5214 316ce5e85b3e
parent 5206 0f6a1bdf89fb
child 5216 335696e2a58f
child 5291 23651848d638
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: