mercurial/util.py
changeset 5207 1108c952cca1
parent 5200 c7e8fe11f34a
parent 5206 0f6a1bdf89fb
child 5216 335696e2a58f
equal deleted inserted replaced
5200:c7e8fe11f34a 5207:1108c952cca1
   475         if not pats:
   475         if not pats:
   476             return
   476             return
   477         try:
   477         try:
   478             pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats])
   478             pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats])
   479             return re.compile(pat).match
   479             return re.compile(pat).match
       
   480         except OverflowError:
       
   481             # We're using a Python with a tiny regex engine and we
       
   482             # made it explode, so we'll divide the pattern list in two
       
   483             # until it works
       
   484             l = len(pats)
       
   485             if l < 2:
       
   486                 raise
       
   487             a, b = matchfn(pats[:l/2], tail), matchfn(pats[l/2:], tail)
       
   488             return lambda s: a(s) or b(s)
   480         except re.error:
   489         except re.error:
   481             for k, p in pats:
   490             for k, p in pats:
   482                 try:
   491                 try:
   483                     re.compile('(?:%s)' % regex(k, p, tail))
   492                     re.compile('(?:%s)' % regex(k, p, tail))
   484                 except re.error:
   493                 except re.error: