Mercurial > hg
diff mercurial/util.py @ 5213: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 |
line wrap: on
line diff
--- a/mercurial/util.py Fri Aug 24 00:38:08 2007 +0200 +++ b/mercurial/util.py Fri Aug 24 00:39:16 2007 +0200 @@ -476,6 +476,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: