Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pure/parsers.py @ 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 | 6104b203bec8 |
line wrap: on
line diff
--- 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