D3531: shortest: avoid magic number "41"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri May 11 19:32:02 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As suggested by Yuya. Feel free to fold into https://phab.mercurial-scm.org/D3502.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list