D4104: index: return False for "len(index) in index"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Aug 5 06:33:54 UTC 2018


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

REVISION SUMMARY
  Since we no longer accept index[len(index)], we should clearly make
  "len(index) in index" return False. This should have been part of
  https://phab.mercurial-scm.org/rHGa3dacabd476b6bed04932b08962d7aa2fd2fad41 (index: don't allow index[len(index)] to mean nullid,
  2018-07-20)

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1393,7 +1393,7 @@
 
 	if (PyInt_Check(value)) {
 		long rev = PyInt_AS_LONG(value);
-		return rev >= -1 && rev < index_length(self) + 1;
+		return rev >= -1 && rev < index_length(self);
 	}
 
 	if (node_check(value, &node) == -1)



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


More information about the Mercurial-devel mailing list