index: return False for "len(index) in index"
authorMartin von Zweigbergk <martinvonz@google.com>
Sat, 04 Aug 2018 23:15:03 -0700
changeset 38866 aa33988ad8ab
parent 38865 899b4c74209c
child 38867 4c0fd3f0a15d
index: return False for "len(index) in index" Since we no longer accept index[len(index)], we should clearly make "len(index) in index" return False. This should have been part of a3dacabd476b (index: don't allow index[len(index)] to mean nullid, 2018-07-20) Differential Revision: https://phab.mercurial-scm.org/D4104
mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c	Sat Jul 21 17:19:12 2018 +0900
+++ b/mercurial/cext/revlog.c	Sat Aug 04 23:15:03 2018 -0700
@@ -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)