# HG changeset patch # User FUJIWARA Katsunori # Date 1456322433 -32400 # Node ID c2f0a47069ef77a47af5a54fcc5a2a2ffc446e53 # Parent 2c29f157463e0499fb5ad8b18b8f2f71e0037517 destutil: replace wc.branch() invocations by cached value for efficiency diff -r 2c29f157463e -r c2f0a47069ef 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