destutil: replace wc.branch() invocations by cached value for efficiency
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 24 Feb 2016 23:00:33 +0900
changeset 28235 c2f0a47069ef
parent 28234 2c29f157463e
child 28236 e333cea74741
destutil: replace wc.branch() invocations by cached value for efficiency
mercurial/destutil.py
--- 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