changeset 45054:cc2572923ea3

revlog: avoid hard-coded hash sizes Differential Revision: https://phab.mercurial-scm.org/D8683
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 06 Jul 2020 14:30:13 +0200
parents 91f4662b7fa7
children 922dbf0df4f1
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jul 03 19:00:01 2020 +0200
+++ b/mercurial/revlog.py	Mon Jul 06 14:30:13 2020 +0200
@@ -1523,7 +1523,7 @@
 
         def disambiguate(hexnode, minlength):
             """Disambiguate against wdirid."""
-            for length in range(minlength, 41):
+            for length in range(minlength, len(hexnode) + 1):
                 prefix = hexnode[:length]
                 if not maybewdir(prefix):
                     return prefix
@@ -1540,12 +1540,12 @@
                 pass
 
         if node == wdirid:
-            for length in range(minlength, 41):
+            for length in range(minlength, len(hexnode) + 1):
                 prefix = hexnode[:length]
                 if isvalid(prefix):
                     return prefix
 
-        for length in range(minlength, 41):
+        for length in range(minlength, len(hexnode) + 1):
             prefix = hexnode[:length]
             if isvalid(prefix):
                 return disambiguate(hexnode, length)