changeset 42029:19ccc6788a27

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
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sun, 17 Mar 2019 18:45:53 +0300
parents 0cc9d7918754
children 6ae1a776dd1a
files mercurial/discovery.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/discovery.py	Sun Mar 17 18:43:27 2019 +0300
+++ b/mercurial/discovery.py	Sun Mar 17 18:45:53 2019 +0300
@@ -212,6 +212,7 @@
     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 @@
             continue
         known = []
         unsynced = []
-        knownnode = cl.hasnode # do not use nodemap until it is filtered
         for h in heads:
             if knownnode(h):
                 known.append(h)