D5309: match: remove obsolete catching of OverflowError

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Nov 29 07:00:59 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2f14d1bbc9a7: match: remove obsolete catching of OverflowError (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5309?vs=12618&id=12656#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5309?vs=12618&id=12656

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

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
@@ -1190,16 +1190,15 @@
     try:
         regex = '(?:%s)' % '|'.join([_regex(k, p, globsuffix)
                                      for (k, p, s) in kindpats])
-        if len(regex) > 20000:
-            raise OverflowError
-        return regex, _rematcher(regex)
-    except OverflowError:
+        if len(regex) <= 20000:
+            return regex, _rematcher(regex)
         # 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(kindpats)
         if l < 2:
-            raise
+            # TODO: raise error.Abort here
+            raise OverflowError
         regexa, a = _buildregexmatch(kindpats[:l//2], globsuffix)
         regexb, b = _buildregexmatch(kindpats[l//2:], globsuffix)
         return regex, lambda s: a(s) or b(s)



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


More information about the Mercurial-devel mailing list