Martin von Zweigbergk <martinvonz@google.com> [Fri, 20 Jul 2018 08:10:32 -0700] rev 38851
index: don't include nullid in len()
I suspect the reason the nullid is in the index in the last position
is that it lets index[i] for regular revision number, even when index
was just a regular Python list. An alternative solution would have
been to reserve revision number 0 for the null revision. I don't know
why that wasn't done. Now that we have classes backing the index, we
can easily make index[-1] get the nullid without having to put it last
in the list and including it in the len().
This patch just hides the nullid -- it will still be accessible at
index[len(index)].
I realize that this will be annoying when checking out across this
commit for debugging (including bisection).
Differential Revision: https://phab.mercurial-scm.org/D4022
Martin von Zweigbergk <martinvonz@google.com> [Wed, 01 Aug 2018 10:57:14 -0700] rev 38850
index: replace insert(-1, e) method by append(e) method
I want to make index[len(index) - 1] be the tip revision, not null
revision as it is today. insert(-1, e) will then make little
sense. Since insert() currently requires the first argument to be -1,
it seems simpler to replace it by a method that allows insertion only
at the end.
Note that revlogoldindex already has this method (by virtue of
extending list).
Differential Revision: https://phab.mercurial-scm.org/D4021
Martin von Zweigbergk <martinvonz@google.com> [Fri, 20 Jul 2018 14:25:59 -0700] rev 38849
pure: create type for revlog v0 index
The new type takes care of hiding the nullid entry. This type helps us
transition away from including that entry at index[len(index)-1].
Differential Revision: https://phab.mercurial-scm.org/D4020
Martin von Zweigbergk <martinvonz@google.com> [Fri, 20 Jul 2018 10:02:05 -0700] rev 38848
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