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

login
register
mail settings
Submitter Brodie Rao
Date Nov. 16, 2013, 2:27 a.m.
Message ID <219c711dbd1540d7b4e8.1384568856@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2962/
State Superseded
Headers show

Comments

Brodie Rao - Nov. 16, 2013, 2:27 a.m.
# HG changeset patch
# User Brodie Rao <brodie@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()

Patch

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