Patchwork D3458: shortest: move some safe code out of exception block

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 12:47 p.m.
Message ID <6578440a837b3087ca49bfcc02d11f82@localhost.localdomain>
Download mbox | patch
Permalink /patch/31338/
State Not Applicable
Headers show

Comments

phabricator - May 8, 2018, 12:47 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG858c7bfb3f49: shortest: move some safe code out of exception block (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3458?vs=8483&id=8512

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1506,22 +1506,21 @@ 
             try:
                 if self._partialmatch(test) is None:
                     return False
-
-                try:
-                    i = int(test)
-                    # if we are a pure int, then starting with zero will not be
-                    # confused as a rev; or, obviously, if the int is larger
-                    # than the value of the tip rev
-                    if test[0] == '0' or i > len(self):
-                        return True
-                    return False
-                except ValueError:
-                    return True
             except error.RevlogError:
                 return False
             except error.WdirUnsupported:
                 # single 'ff...' match
                 return True
+            try:
+                i = int(test)
+                # if we are a pure int, then starting with zero will not be
+                # confused as a rev; or, obviously, if the int is larger
+                # than the value of the tip rev
+                if test[0] == '0' or i > len(self):
+                    return True
+                return False
+            except ValueError:
+                return True
 
         hexnode = hex(node)
         shortest = hexnode