[PATCH 04 of 12] localrepo: refactor repo.branchtip() to use repo.branchmap().branchtip()

Brodie Rao brodie at sf.io
Fri Nov 15 20:27:36 CST 2013


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID 219c711dbd1540d7b4e88765f9c032738156386d
# Parent  4089d25214631ffe66f18e5de52febe3ed3992a0
localrepo: refactor repo.branchtip() to use repo.branchmap().branchtip()

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -666,9 +666,10 @@ class localrepository(object):
 
     def branchtip(self, branch):
         '''return the tip node for a given branch'''
-        if branch not in self.branchmap():
+        try:
+            return self.branchmap().branchtip(branch)
+        except KeyError:
             raise error.RepoLookupError(_("unknown branch '%s'") % branch)
-        return self._branchtip(self.branchmap()[branch])
 
     def branchtags(self):
         '''return a dict where branch names map to the tipmost head of


More information about the Mercurial-devel mailing list