# HG changeset patch # User Martin von Zweigbergk # Date 2018-08-29 22:49:11 # Node ID 570fca90d55687327049e4f24dd5fb01eb070fbc # Parent bc0eb1dc6aaeed79f127541723c7a634b8f819d9 shortest: fix an off-by-1 when disambiguating against revnums Revision "5" is an unambiguous hex prefix in a repo with 5 revisions; it's only "4" and lower that are ambiguous. Differential Revision: https://phab.mercurial-scm.org/D4420 diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -475,7 +475,7 @@ def mayberevnum(repo, 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 prefix[0:1] == b'0' or i > len(repo): + if prefix[0:1] == b'0' or i >= len(repo): return False return True except ValueError: