##// END OF EJS Templates
push: include phase push in the unified bundle2 push...
Pierre-Yves David -
r22020:311979b7 default
parent child Browse files
Show More
@@ -366,6 +366,37 b' def _pushb2ctx(pushop, bundler):'
366 pushop.ret = cgreplies['changegroup'][0]['return']
366 pushop.ret = cgreplies['changegroup'][0]['return']
367 return handlereply
367 return handlereply
368
368
369 @b2partsgenerator('phase')
370 def _pushb2phases(pushop, bundler):
371 """handle phase push through bundle2"""
372 if 'phases' in pushop.stepsdone:
373 return
374 b2caps = bundle2.bundle2caps(pushop.remote)
375 if not 'b2x:pushkey' in b2caps:
376 return
377 pushop.stepsdone.add('phases')
378 part2node = []
379 enc = pushkey.encode
380 for newremotehead in pushop.outdatedphases:
381 part = bundler.newpart('b2x:pushkey')
382 part.addparam('namespace', enc('phases'))
383 part.addparam('key', enc(newremotehead.hex()))
384 part.addparam('old', enc(str(phases.draft)))
385 part.addparam('new', enc(str(phases.public)))
386 part2node.append((part.id, newremotehead))
387 def handlereply(op):
388 for partid, node in part2node:
389 partrep = op.records.getreplies(partid)
390 results = partrep['pushkey']
391 assert len(results) <= 1
392 msg = None
393 if not results:
394 msg = _('server ignored update of %s to public!\n') % node
395 elif not int(results[0]['return']):
396 msg = _('updating %s to public failed!\n') % node
397 if msg is not None:
398 pushop.ui.warn(msg)
399 return handlereply
369
400
370 def _pushbundle2(pushop):
401 def _pushbundle2(pushop):
371 """push data to the remote using bundle2
402 """push data to the remote using bundle2
@@ -480,13 +511,17 b' def _pushsyncphase(pushop):'
480 ### Apply local phase on remote
511 ### Apply local phase on remote
481
512
482 if pushop.ret:
513 if pushop.ret:
514 if 'phases' in pushop.stepsdone:
515 # phases already pushed though bundle2
516 return
483 outdated = pushop.outdatedphases
517 outdated = pushop.outdatedphases
484 else:
518 else:
485 outdated = pushop.fallbackoutdatedphases
519 outdated = pushop.fallbackoutdatedphases
486
520
521 pushop.stepsdone.add('phases')
522
487 # filter heads already turned public by the push
523 # filter heads already turned public by the push
488 outdated = [c for c in outdated if c.node() not in pheads]
524 outdated = [c for c in outdated if c.node() not in pheads]
489
490 b2caps = bundle2.bundle2caps(pushop.remote)
525 b2caps = bundle2.bundle2caps(pushop.remote)
491 if 'b2x:pushkey' in b2caps:
526 if 'b2x:pushkey' in b2caps:
492 # server supports bundle2, let's do a batched push through it
527 # server supports bundle2, let's do a batched push through it
General Comments 0
You need to be logged in to leave comments. Login now