# HG changeset patch # User Joerg Sonnenberger # Date 2020-07-06 12:30:13 # Node ID cc2572923ea3f0a2e7fcf4654517883a3fbd45ab # Parent 91f4662b7fa7a8b669586bfefe5278c5d64d7844 revlog: avoid hard-coded hash sizes Differential Revision: https://phab.mercurial-scm.org/D8683 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1523,7 +1523,7 @@ class revlog(object): 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 @@ class revlog(object): 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)