Patchwork [05,of,13,V2] localrepo: refactor repo.branchtip() to use repo.branchmap().branchtip()

login
register
mail settings
Submitter Brodie Rao
Date Nov. 16, 2013, 4:18 a.m.
Message ID <6b2a5372b1bbffa4eac9.1384575529@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2981/
State Accepted
Commit 4d6d5ef885384feb3178e9d799e4b22da3b1e7d0
Headers show

Comments

Brodie Rao - Nov. 16, 2013, 4:18 a.m.
# HG changeset patch
# User Brodie Rao <brodie@sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID 6b2a5372b1bbffa4eac972e49d15f2283b5c2dd7
# Parent  0ed65d30c55d995856a92667c3eddaede742c47c
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