Patchwork D3459: shortest: rename "test" variable to "prefix"

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 12:47 p.m.
Message ID <4ca46b4207e26a64e82c6f10ba371e46@localhost.localdomain>
Download mbox | patch
Permalink /patch/31340/
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 rHG6921d3ecadc1: shortest: rename &quot;test&quot; variable to &quot;prefix&quot; (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3459?vs=8484&id=8513

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

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
@@ -1502,21 +1502,21 @@ 
 
     def shortest(self, node, minlength=1):
         """Find the shortest unambiguous prefix that matches node."""
-        def isvalid(test):
+        def isvalid(prefix):
             try:
-                if self._partialmatch(test) is None:
+                if self._partialmatch(prefix) is None:
                     return False
             except error.RevlogError:
                 return False
             except error.WdirUnsupported:
                 # single 'ff...' match
                 return True
             try:
-                i = int(test)
+                i = int(prefix)
                 # 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):
+                if prefix[0] == '0' or i > len(self):
                     return True
                 return False
             except ValueError:
@@ -1527,9 +1527,9 @@ 
         startlength = max(6, minlength)
         length = startlength
         while True:
-            test = hexnode[:length]
-            if isvalid(test):
-                shortest = test
+            prefix = hexnode[:length]
+            if isvalid(prefix):
+                shortest = prefix
                 if length == minlength or length > startlength:
                     return shortest
                 length -= 1