changeset 38887:c0d411ea6639

index: drop support for negative indexes into the index I want index[i] to work for any valid revnum including -1 (as it already does), and I also want len(index) to be the number of revisions in the index (not counting the null revision), so it cannot also support negative revision numbers other than -1 for nullid. I didn't bother removing support for it from revlog v0. Differential Revision: https://phab.mercurial-scm.org/D4019
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 20 Jul 2018 10:02:05 -0700
parents f3d394ea17db
children da5a666f0f78
files mercurial/cext/revlog.c mercurial/pure/parsers.py
diffstat 2 files changed, 0 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Fri Jul 20 09:53:54 2018 -0700
+++ b/mercurial/cext/revlog.c	Fri Jul 20 10:02:05 2018 -0700
@@ -163,9 +163,6 @@
 		return nullentry;
 	}
 
-	if (pos < 0)
-		pos += length;
-
 	if (pos < 0 || pos >= length) {
 		PyErr_SetString(PyExc_IndexError, "revlog index out of range");
 		return NULL;
--- a/mercurial/pure/parsers.py	Fri Jul 20 09:53:54 2018 -0700
+++ b/mercurial/pure/parsers.py	Fri Jul 20 10:02:05 2018 -0700
@@ -48,8 +48,6 @@
     def _fix_index(self, i):
         if not isinstance(i, int):
             raise TypeError("expecting int indexes")
-        if i < 0:
-            i = len(self) + i
         if i < 0 or i >= len(self):
             raise IndexError
         return i