HomePhabricator

index: don't include nullid in len()

Authored by martinvonz.

Description

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

Details

Committed
martinvonzJul 20 2018, 11:10 AM
Differential Revision
D4022: index: don't include nullid in len()
Parents
rHG6104b203bec8: index: replace insert(-1, e) method by append(e) method
Branches
Unknown
Tags
Unknown