# HG changeset patch # User Matt Mackall # Date 2008-02-11 22:13:43 # Node ID 59a9dc9562e24d5e5890c7d957ef2b91cb12e8a0 # Parent 89c70d496175b2e359161a85a66e59fcc0f53012 ignore: split up huge patterns Some versions of Python silently mishandle large regexes, so split them up at a conservative 20k. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -459,6 +459,8 @@ def _matcher(canonroot, cwd, names, inc, return try: pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats]) + if len(pat) > 20000: + raise OverflowError() return re.compile(pat).match except OverflowError: # We're using a Python with a tiny regex engine and we