D4019: index: drop support for negative indexes into the index
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=9882 REVISION DETAIL https://phab.mercurial-scm.org/D4019 AFFECTED FILES mercurial/cext/revlog.c mercurial/pure/parsers.py CHANGE DETAILS 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; To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4019: index: drop support for negative indexes into the index
martinvonz updated this revision to Diff 9778. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4019?vs=9719=9778 REVISION DETAIL https://phab.mercurial-scm.org/D4019 AFFECTED FILES mercurial/cext/revlog.c mercurial/pure/parsers.py CHANGE DETAILS 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; To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4019: index: drop support for negative indexes into the index
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4019 AFFECTED FILES mercurial/cext/revlog.c mercurial/pure/parsers.py CHANGE DETAILS 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; To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel