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; 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