# HG changeset patch # User Matt Mackall # Date 1187550266 18000 # Node ID 1108c952cca193114452b9004f5d5ae5d59657f9 # Parent c7e8fe11f34a037f1d5df53e5bf22f59551477c8# Parent 0f6a1bdf89fb9b8e6c260a56a96063df3d57a636 Merge with -stable diff -r c7e8fe11f34a -r 1108c952cca1 mercurial/util.py --- a/mercurial/util.py Sat Aug 18 21:36:10 2007 -0300 +++ b/mercurial/util.py Sun Aug 19 14:04:26 2007 -0500 @@ -477,6 +477,15 @@ try: pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats]) return re.compile(pat).match + except OverflowError: + # We're using a Python with a tiny regex engine and we + # made it explode, so we'll divide the pattern list in two + # until it works + l = len(pats) + if l < 2: + raise + a, b = matchfn(pats[:l/2], tail), matchfn(pats[l/2:], tail) + return lambda s: a(s) or b(s) except re.error: for k, p in pats: try: