mercurial/util.py
changeset 5201 0f6a1bdf89fb
parent 5077 84b10dc3dccc
child 5202 1108c952cca1
child 5213 b0bc8cf41ffc
equal deleted inserted replaced
5190:6d5ed61c508c 5201:0f6a1bdf89fb
   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: