shortest: avoid magic number "41"
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 11 May 2018 09:16:26 -0700
changeset 38023 5ac72e07692a
parent 38022 312d7d14d44e
child 38024 bbdc1bc56e58
shortest: avoid magic number "41" As suggested by Yuya. Feel free to fold into D3502. Differential Revision: https://phab.mercurial-scm.org/D3531
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri May 11 07:31:51 2018 -0700
+++ b/mercurial/scmutil.py	Fri May 11 09:16:26 2018 -0700
@@ -466,7 +466,7 @@
     def disambiguate(prefix):
         """Disambiguate against revnums."""
         hexnode = hex(node)
-        for length in range(len(prefix), 41):
+        for length in range(len(prefix), len(hexnode) + 1):
             prefix = hexnode[:length]
             if not isrev(prefix):
                 return prefix