Patchwork D7250: revlog: move tiprev() from changelog up to revlog

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 3:38 a.m.
Message ID <46025b980b9672db22e0ce3654e390ee@localhost.localdomain>
Download mbox | patch
Permalink /patch/42785/
State Not Applicable
Headers show

Comments

phabricator - Nov. 6, 2019, 3:38 a.m.
Closed by commit rHG2860f6019b85: revlog: move tiprev() from changelog up to revlog (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7250?vs=17580&id=17584

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7250/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7250

AFFECTED FILES
  mercurial/changelog.py
  mercurial/revlog.py

CHANGE DETAILS




To: martinvonz, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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)
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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