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

login
register
mail settings
Submitter Boris Feld
Date Jan. 17, 2018, 6:33 p.m.
Message ID <048bded89f6f917d7e35.1516214030@FB>
Download mbox | patch
Permalink /patch/26822/
State Accepted
Headers show

Comments

Boris Feld - Jan. 17, 2018, 6:33 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.

Patch

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__"""