# HG changeset patch # User Pulkit Goyal # Date 2019-03-17 15:45:53 # Node ID 19ccc6788a270912bf277488a98cc5f470ded0d9 # Parent 0cc9d79187540986257147e0a3fe875383121073 discovery: move cl.hasnode outside of the for-loop IIUC, resolving attributes for changelog can lead to some overhead. So this patch moves that to outside of a for-loop. Differential Revision: https://phab.mercurial-scm.org/D6147 diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -212,6 +212,7 @@ def _headssummary(pushop): with remote.commandexecutor() as e: remotemap = e.callcommand('branchmap', {}).result() + knownnode = cl.hasnode # do not use nodemap until it is filtered # A. register remote heads of branches which are in outgoing set for branch, heads in remotemap.iteritems(): # don't add head info about branches which we don't have locally @@ -219,7 +220,6 @@ def _headssummary(pushop): continue known = [] unsynced = [] - knownnode = cl.hasnode # do not use nodemap until it is filtered for h in heads: if knownnode(h): known.append(h)