D5350: match: make "groupsize" include the trailing "|"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Dec 2 21:53:36 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think this is a little easier to follow and it will simplify later
  patches too.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5350

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -1185,7 +1185,7 @@
         return regex, lambda f: any(mf(f) for mf in matchfuncs)
 
 MAX_RE_SIZE = 20000
-_BASE_SIZE = len('(?:)') - 1
+_BASE_SIZE = len('(?:)')
 
 def _joinregexes(regexps):
     """gather multiple regular expressions into a single one"""
@@ -1215,7 +1215,7 @@
             if (piecesize + 4) > MAX_RE_SIZE:
                 msg = _("matcher pattern is too long (%d bytes)") % piecesize
                 raise error.Abort(msg)
-            elif (groupsize + 1 + piecesize) > MAX_RE_SIZE:
+            elif (groupsize + piecesize) > MAX_RE_SIZE:
                 group = regexps[startidx:idx]
                 allgroups.append(_joinregexes(group))
                 startidx = idx



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list