[PATCH 6 of 6 V3] match: raise an Abort error instead of OverflowError
Boris Feld
boris.feld at octobus.net
Fri Nov 23 09:12:49 EST 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542904870 -3600
# Thu Nov 22 17:41:10 2018 +0100
# Node ID 0aed4a6bdbfb848a8a6d10581721a40bd5d7d508
# Parent b41a4db20b0898e57f9fa0bb9ebdabb30a53df75
# EXP-Topic perf-ignore
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 0aed4a6bdbfb
match: raise an Abort error instead of OverflowError
This case of OverflowError (one single pattern being too large) has never been
properly caught in the past.
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -1201,7 +1201,7 @@ def _buildregexmatch(kindpats, globsuffi
... ], '$')
Traceback (most recent call last):
...
- OverflowError
+ Abort: matcher pattern is too long (20009 bytes)
"""
try:
allgroups = []
@@ -1213,7 +1213,8 @@ def _buildregexmatch(kindpats, globsuffi
for idx, r in enumerate(regexps):
piecesize = len(r)
if (piecesize + 4) > MAX_RE_SIZE:
- raise OverflowError
+ msg = _("matcher pattern is too long (%d bytes)") % piecesize
+ raise error.Abort(msg)
elif (groupsize + 1 + piecesize) > MAX_RE_SIZE:
group = regexps[startidx:idx]
allgroups.append(_joinregexes(group))
More information about the Mercurial-devel
mailing list