##// END OF EJS Templates
push: stop independent usage of bundle2 in syncphase (issue4454)...
Pierre-Yves David -
r23376:2e65da5f stable
parent child Browse files
Show More
@@ -666,51 +666,15 b' def _pushsyncphase(pushop):'
666 666
667 667 # filter heads already turned public by the push
668 668 outdated = [c for c in outdated if c.node() not in pheads]
669 b2caps = bundle2.bundle2caps(pushop.remote)
670 if 'b2x:pushkey' in b2caps:
671 # server supports bundle2, let's do a batched push through it
672 #
673 # This will eventually be unified with the changesets bundle2 push
674 bundler = bundle2.bundle20(pushop.ui, b2caps)
675 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo))
676 bundler.newpart('b2x:replycaps', data=capsblob)
677 part2node = []
678 enc = pushkey.encode
679 for newremotehead in outdated:
680 part = bundler.newpart('b2x:pushkey')
681 part.addparam('namespace', enc('phases'))
682 part.addparam('key', enc(newremotehead.hex()))
683 part.addparam('old', enc(str(phases.draft)))
684 part.addparam('new', enc(str(phases.public)))
685 part2node.append((part.id, newremotehead))
686 stream = util.chunkbuffer(bundler.getchunks())
687 try:
688 reply = pushop.remote.unbundle(stream, ['force'], 'push')
689 op = bundle2.processbundle(pushop.repo, reply)
690 except error.BundleValueError, exc:
691 raise util.Abort('missing support for %s' % exc)
692 for partid, node in part2node:
693 partrep = op.records.getreplies(partid)
694 results = partrep['pushkey']
695 assert len(results) <= 1
696 msg = None
697 if not results:
698 msg = _('server ignored update of %s to public!\n') % node
699 elif not int(results[0]['return']):
700 msg = _('updating %s to public failed!\n') % node
701 if msg is not None:
702 pushop.ui.warn(msg)
703
704 else:
705 # fallback to independant pushkey command
706 for newremotehead in outdated:
707 r = pushop.remote.pushkey('phases',
708 newremotehead.hex(),
709 str(phases.draft),
710 str(phases.public))
711 if not r:
712 pushop.ui.warn(_('updating %s to public failed!\n')
713 % newremotehead)
669 # fallback to independent pushkey command
670 for newremotehead in outdated:
671 r = pushop.remote.pushkey('phases',
672 newremotehead.hex(),
673 str(phases.draft),
674 str(phases.public))
675 if not r:
676 pushop.ui.warn(_('updating %s to public failed!\n')
677 % newremotehead)
714 678
715 679 def _localphasemove(pushop, nodes, phase=phases.public):
716 680 """move <nodes> to <phase> in the local source repo"""
General Comments 0
You need to be logged in to leave comments. Login now