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 |