Patchwork D5309: match: remove obsolete catching of OverflowError

login
register
mail settings
Submitter phabricator
Date Nov. 29, 2018, noon
Message ID <8d86cdfe478ce840b0ff3ec6660ba5e0@localhost.localdomain>
Download mbox | patch
Permalink /patch/36868/
State Not Applicable
Headers show

Comments

phabricator - Nov. 29, 2018, noon
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




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

Patch

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)