D4420: shortest: fix an off-by-1 when disambiguating against revnums

2018-08-30 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG570fca90d556: shortest: fix an off-by-1 when disambiguating 
against revnums (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4420?vs=10660=10671

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

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
@@ -475,7 +475,7 @@
 # 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:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4420: shortest: fix an off-by-1 when disambiguating against revnums

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Revision "5" is an unambiguous hex prefix in a repo with 5 revisions;
  it's only "4" and lower that are ambiguous.

REPOSITORY
  rHG Mercurial

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

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
@@ -475,7 +475,7 @@
 # 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:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel