comparison mercurial/repoview.py @ 38851:781b2720d2ac

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 20 Jul 2018 08:10:32 -0700
parents e7aa113b14f7
children 06c976acc581
comparison
equal deleted inserted replaced
38850:6104b203bec8 38851:781b2720d2ac
208 # some cache may be implemented later 208 # some cache may be implemented later
209 unfi = self._unfilteredrepo 209 unfi = self._unfilteredrepo
210 unfichangelog = unfi.changelog 210 unfichangelog = unfi.changelog
211 # bypass call to changelog.method 211 # bypass call to changelog.method
212 unfiindex = unfichangelog.index 212 unfiindex = unfichangelog.index
213 unfilen = len(unfiindex) - 1 213 unfilen = len(unfiindex)
214 unfinode = unfiindex[unfilen - 1][7] 214 unfinode = unfiindex[unfilen - 1][7]
215 215
216 revs = filterrevs(unfi, self.filtername, self._visibilityexceptions) 216 revs = filterrevs(unfi, self.filtername, self._visibilityexceptions)
217 cl = self._clcache 217 cl = self._clcache
218 newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed) 218 newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed)