D6147: discovery: move cl.hasnode outside of the for-loop

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Mar 17 11:49:21 EDT 2019


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  IIUC, resolving attributes for changelog can lead to some overhead. So this
  patch moves that to outside of a for-loop.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6147

AFFECTED FILES
  mercurial/discovery.py

CHANGE DETAILS

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -212,14 +212,14 @@
     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
         if branch not in branches:
             continue
         known = []
         unsynced = []
-        knownnode = cl.hasnode # do not use nodemap until it is filtered
         for h in heads:
             if knownnode(h):
                 known.append(h)



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list