changeset 37863:6921d3ecadc1

shortest: rename "test" variable to "prefix" Sorry if this is considered churn, but "prefix" just seems much clearer to me. Differential Revision: https://phab.mercurial-scm.org/D3459
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 03 May 2018 10:12:47 -0700
parents 858c7bfb3f49
children 890bdf0e33c8
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed May 02 22:49:06 2018 -0700
+++ b/mercurial/revlog.py	Thu May 03 10:12:47 2018 -0700
@@ -1502,9 +1502,9 @@
 
     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
@@ -1512,11 +1512,11 @@
                 # 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