Mercurial > hg-stable
comparison mercurial/discovery.py @ 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 | 5997eabc7b85 |
comparison
equal
deleted
inserted
replaced
42028:0cc9d7918754 | 42029:19ccc6788a27 |
---|---|
210 branches.add(ctx.branch()) | 210 branches.add(ctx.branch()) |
211 | 211 |
212 with remote.commandexecutor() as e: | 212 with remote.commandexecutor() as e: |
213 remotemap = e.callcommand('branchmap', {}).result() | 213 remotemap = e.callcommand('branchmap', {}).result() |
214 | 214 |
215 knownnode = cl.hasnode # do not use nodemap until it is filtered | |
215 # A. register remote heads of branches which are in outgoing set | 216 # A. register remote heads of branches which are in outgoing set |
216 for branch, heads in remotemap.iteritems(): | 217 for branch, heads in remotemap.iteritems(): |
217 # don't add head info about branches which we don't have locally | 218 # don't add head info about branches which we don't have locally |
218 if branch not in branches: | 219 if branch not in branches: |
219 continue | 220 continue |
220 known = [] | 221 known = [] |
221 unsynced = [] | 222 unsynced = [] |
222 knownnode = cl.hasnode # do not use nodemap until it is filtered | |
223 for h in heads: | 223 for h in heads: |
224 if knownnode(h): | 224 if knownnode(h): |
225 known.append(h) | 225 known.append(h) |
226 else: | 226 else: |
227 unsynced.append(h) | 227 unsynced.append(h) |