# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1542903632 -3600 # Thu Nov 22 17:20:32 2018 +0100 # Node ID 8847fda442975010d004dcb0293a40ba70434070 # Parent 917fa088dd67d1f56c751de59acc91abc799d83a # EXP-Topic perf-ignore # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8847fda44297 match: extract a literal constant into a symbolic one
diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -1184,13 +1184,15 @@ def _buildmatch(kindpats, globsuffix, li else: return regex, lambda f: any(mf(f) for mf in matchfuncs) +MAX_RE_SIZE = 20000 + def _buildregexmatch(kindpats, globsuffix): """Build a match function from a list of kinds and kindpats, return regexp string and a matcher function.""" try: regex = '(?:%s)' % '|'.join([_regex(k, p, globsuffix) for (k, p, s) in kindpats]) - if len(regex) > 20000: + if len(regex) > MAX_RE_SIZE: raise OverflowError return regex, _rematcher(regex) except OverflowError: _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel