##// 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,43 +666,7 b' def _pushsyncphase(pushop):'
666
666
667 # filter heads already turned public by the push
667 # filter heads already turned public by the push
668 outdated = [c for c in outdated if c.node() not in pheads]
668 outdated = [c for c in outdated if c.node() not in pheads]
669 b2caps = bundle2.bundle2caps(pushop.remote)
669 # fallback to independent pushkey command
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:
670 for newremotehead in outdated:
707 r = pushop.remote.pushkey('phases',
671 r = pushop.remote.pushkey('phases',
708 newremotehead.hex(),
672 newremotehead.hex(),
General Comments 0
You need to be logged in to leave comments. Login now