# HG changeset patch # User Martin von Zweigbergk # Date 1572993728 28800 # Node ID ec7ba79bf3db903fc69aa204bc9ae2bd036f1b90 # Parent 0a0bad6d7ac03ed3354accf5308adeed989314ce revlog: move tiprev() from changelog up to revlog This makes the changelog override simpler and it seems more consistent. Differential Revision: https://phab.mercurial-scm.org/D7250 diff -r 0a0bad6d7ac0 -r ec7ba79bf3db mercurial/changelog.py --- a/mercurial/changelog.py Tue Nov 05 18:25:13 2019 -0500 +++ b/mercurial/changelog.py Tue Nov 05 14:42:08 2019 -0800 @@ -406,14 +406,11 @@ self._copiesstorage = opener.options.get(b'copies-storage') def tiprev(self): + """filtered version of revlog.tiprev""" for i in pycompat.xrange(len(self) - 1, -2, -1): if i not in self.filteredrevs: return i - def tip(self): - """filtered version of revlog.tip""" - return self.node(self.tiprev()) - def __contains__(self, rev): """filtered version of revlog.__contains__""" return 0 <= rev < len(self) and rev not in self.filteredrevs diff -r 0a0bad6d7ac0 -r ec7ba79bf3db mercurial/revlog.py --- a/mercurial/revlog.py Tue Nov 05 18:25:13 2019 -0500 +++ b/mercurial/revlog.py Tue Nov 05 14:42:08 2019 -0800 @@ -593,8 +593,11 @@ with func() as fp: yield fp + def tiprev(self): + return len(self.index) - 1 + def tip(self): - return self.node(len(self.index) - 1) + return self.node(self.tiprev()) def __contains__(self, rev): return 0 <= rev < len(self)