Mercurial > hg
changeset 38844:119d14f41cb2
revlog: remove some knowledge of sentinel nullid in index
I think the "-2" to mean "last position in index, not counting the
null revision at the end" is an implementation detail of the index
that we should avoid spreading knowledge of. I hope we can even remove
support for index[-2].
Differential Revision: https://phab.mercurial-scm.org/D4016
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 20 Jul 2018 09:58:09 -0700 |
parents | 6f7c9527030b |
children | f9fc59ea3135 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri Apr 13 23:23:47 2018 -0700 +++ b/mercurial/revlog.py Fri Jul 20 09:58:09 2018 -0700 @@ -2247,7 +2247,9 @@ revlog has grown too large to be an inline revlog, it will convert it to use multiple index and data files. """ - if not self._inline or (self.start(-2) + self.length(-2)) < _maxinline: + tiprev = len(self) - 1 + if (not self._inline or + (self.start(tiprev) + self.length(tiprev)) < _maxinline): return trinfo = tr.find(self.indexfile) @@ -2261,7 +2263,7 @@ else: # revlog was stripped at start of transaction, use all leftover data trindex = len(self) - 1 - dataoff = self.end(-2) + dataoff = self.end(tiprev) tr.add(self.datafile, dataoff)