comparison mercurial/exchange.py @ 21555:e303b8ea84b3

exchange: drop dead code This code have been factorised and moved in its own function by 7d0bbb6dd730. We actually read the result of this other computation in the very line before the deleted block. I somehow forgot to remove the original code, but it is now dead. Good bye duplicated computation.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 22 May 2014 16:27:16 -0700
parents 7bcf4adadd2d
children 5e08f3b65510
comparison
equal deleted inserted replaced
21554:7bcf4adadd2d 21555:e303b8ea84b3
328 328
329 def _pushsyncphase(pushop): 329 def _pushsyncphase(pushop):
330 """synchronise phase information locally and remotely""" 330 """synchronise phase information locally and remotely"""
331 unfi = pushop.repo.unfiltered() 331 unfi = pushop.repo.unfiltered()
332 cheads = pushop.commonheads 332 cheads = pushop.commonheads
333 if pushop.ret:
334 # push succeed, synchronize target of the push
335 cheads = pushop.outgoing.missingheads
336 elif pushop.revs is None:
337 # All out push fails. synchronize all common
338 cheads = pushop.outgoing.commonheads
339 else:
340 # I want cheads = heads(::missingheads and ::commonheads)
341 # (missingheads is revs with secret changeset filtered out)
342 #
343 # This can be expressed as:
344 # cheads = ( (missingheads and ::commonheads)
345 # + (commonheads and ::missingheads))"
346 # )
347 #
348 # while trying to push we already computed the following:
349 # common = (::commonheads)
350 # missing = ((commonheads::missingheads) - commonheads)
351 #
352 # We can pick:
353 # * missingheads part of common (::commonheads)
354 common = set(pushop.outgoing.common)
355 nm = pushop.repo.changelog.nodemap
356 cheads = [node for node in pushop.revs if nm[node] in common]
357 # and
358 # * commonheads parents on missing
359 revset = unfi.set('%ln and parents(roots(%ln))',
360 pushop.outgoing.commonheads,
361 pushop.outgoing.missing)
362 cheads.extend(c.node() for c in revset)
363 pushop.commonheads = cheads
364 # even when we don't push, exchanging phase data is useful 333 # even when we don't push, exchanging phase data is useful
365 remotephases = pushop.remote.listkeys('phases') 334 remotephases = pushop.remote.listkeys('phases')
366 if (pushop.ui.configbool('ui', '_usedassubrepo', False) 335 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
367 and remotephases # server supports phases 336 and remotephases # server supports phases
368 and pushop.ret is None # nothing was pushed 337 and pushop.ret is None # nothing was pushed