Patchwork D4019: index: drop support for negative indexes into the index

login
register
mail settings
Submitter phabricator
Date Aug. 4, 2018, 4:06 a.m.
Message ID <d9a053350b6f55972ce81ef85e171748@localhost.localdomain>
Download mbox | patch
Permalink /patch/33214/
State Not Applicable
Headers show

Comments

phabricator - Aug. 4, 2018, 4:06 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc0d411ea6639: index: drop support for negative indexes into the index (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4019?vs=9778&id=9882

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

AFFECTED FILES
  mercurial/cext/revlog.c
  mercurial/pure/parsers.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -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
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -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;