D4016: revlog: remove some knowledge of sentinel nullid in index
This revision was automatically updated to reflect the committed changes. Closed by commit rHG119d14f41cb2: revlog: remove some knowledge of sentinel nullid in index (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4016?vs=9776=9878 REVISION DETAIL https://phab.mercurial-scm.org/D4016 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -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) To: martinvonz, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4016: revlog: remove some knowledge of sentinel nullid in index
martinvonz updated this revision to Diff 9776. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4016?vs=9716=9776 REVISION DETAIL https://phab.mercurial-scm.org/D4016 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2246,7 +2246,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) @@ -2260,7 +2262,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) To: martinvonz, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4016: revlog: remove some knowledge of sentinel nullid in index
martinvonz created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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]. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4016 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2246,7 +2246,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) @@ -2260,7 +2262,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) To: martinvonz, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel