changeset 28235:c2f0a47069ef

destutil: replace wc.branch() invocations by cached value for efficiency
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 24 Feb 2016 23:00:33 +0900
parents 2c29f157463e
children e333cea74741
files mercurial/destutil.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/destutil.py	Wed Feb 24 23:00:32 2016 +0900
+++ b/mercurial/destutil.py	Wed Feb 24 23:00:33 2016 +0900
@@ -91,16 +91,17 @@
     """decide on an update destination from current branch"""
     wc = repo[None]
     movemark = node = None
+    currentbranch = wc.branch()
     try:
         node = repo.revs('max(.::(head() and branch(%s)))'
-                         , wc.branch()).first()
+                         , currentbranch).first()
         if bookmarks.isactivewdirparent(repo):
             movemark = repo['.'].node()
     except error.RepoLookupError:
-        if wc.branch() == 'default': # no default branch!
+        if currentbranch == 'default': # no default branch!
             node = repo.lookup('tip') # update to tip
         else:
-            raise error.Abort(_("branch %s not found") % wc.branch())
+            raise error.Abort(_("branch %s not found") % currentbranch)
     return node, movemark, None
 
 # order in which each step should be evalutated