[PATCH 2 of 5] changelog: use 'tiprev()' in 'tip()'

Boris Feld boris.feld at octobus.net
Wed Jan 17 13:33:50 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1493857444 -7200
#      Thu May 04 02:24:04 2017 +0200
# Node ID 048bded89f6f917d7e3514e2318ab3b0af825a34
# Parent  e3bb410037a49980a8316e4e5a49ab23ea978047
# EXP-Topic tiprev
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 048bded89f6f
changelog: use 'tiprev()' in 'tip()'

Since 'tip()' is just a node version of 'tiprev()' we should reuse the code.

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -302,9 +302,7 @@ class changelog(revlog.revlog):
 
     def tip(self):
         """filtered version of revlog.tip"""
-        for i in xrange(len(self) -1, -2, -1):
-            if i not in self.filteredrevs:
-                return self.node(i)
+        return self.node(self.tiprev())
 
     def __contains__(self, rev):
         """filtered version of revlog.__contains__"""


More information about the Mercurial-devel mailing list