Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 23382:a81c76106d90
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 22 Nov 2014 17:09:04 -0600 |
parents | 6c1351352b6c 2e65da5f80df |
children | 52db731b964d |
comparison
equal
deleted
inserted
replaced
23380:90cc552ceed5 | 23382:a81c76106d90 |
---|---|
679 | 679 |
680 pushop.stepsdone.add('phases') | 680 pushop.stepsdone.add('phases') |
681 | 681 |
682 # filter heads already turned public by the push | 682 # filter heads already turned public by the push |
683 outdated = [c for c in outdated if c.node() not in pheads] | 683 outdated = [c for c in outdated if c.node() not in pheads] |
684 b2caps = bundle2.bundle2caps(pushop.remote) | 684 # fallback to independent pushkey command |
685 if 'b2x:pushkey' in b2caps: | 685 for newremotehead in outdated: |
686 # server supports bundle2, let's do a batched push through it | 686 r = pushop.remote.pushkey('phases', |
687 # | 687 newremotehead.hex(), |
688 # This will eventually be unified with the changesets bundle2 push | 688 str(phases.draft), |
689 bundler = bundle2.bundle20(pushop.ui, b2caps) | 689 str(phases.public)) |
690 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo)) | 690 if not r: |
691 bundler.newpart('b2x:replycaps', data=capsblob) | 691 pushop.ui.warn(_('updating %s to public failed!\n') |
692 part2node = [] | 692 % newremotehead) |
693 enc = pushkey.encode | |
694 for newremotehead in outdated: | |
695 part = bundler.newpart('b2x:pushkey') | |
696 part.addparam('namespace', enc('phases')) | |
697 part.addparam('key', enc(newremotehead.hex())) | |
698 part.addparam('old', enc(str(phases.draft))) | |
699 part.addparam('new', enc(str(phases.public))) | |
700 part2node.append((part.id, newremotehead)) | |
701 stream = util.chunkbuffer(bundler.getchunks()) | |
702 try: | |
703 reply = pushop.remote.unbundle(stream, ['force'], 'push') | |
704 op = bundle2.processbundle(pushop.repo, reply) | |
705 except error.BundleValueError, exc: | |
706 raise util.Abort('missing support for %s' % exc) | |
707 for partid, node in part2node: | |
708 partrep = op.records.getreplies(partid) | |
709 results = partrep['pushkey'] | |
710 assert len(results) <= 1 | |
711 msg = None | |
712 if not results: | |
713 msg = _('server ignored update of %s to public!\n') % node | |
714 elif not int(results[0]['return']): | |
715 msg = _('updating %s to public failed!\n') % node | |
716 if msg is not None: | |
717 pushop.ui.warn(msg) | |
718 | |
719 else: | |
720 # fallback to independent pushkey command | |
721 for newremotehead in outdated: | |
722 r = pushop.remote.pushkey('phases', | |
723 newremotehead.hex(), | |
724 str(phases.draft), | |
725 str(phases.public)) | |
726 if not r: | |
727 pushop.ui.warn(_('updating %s to public failed!\n') | |
728 % newremotehead) | |
729 | 693 |
730 def _localphasemove(pushop, nodes, phase=phases.public): | 694 def _localphasemove(pushop, nodes, phase=phases.public): |
731 """move <nodes> to <phase> in the local source repo""" | 695 """move <nodes> to <phase> in the local source repo""" |
732 if pushop.locallocked: | 696 if pushop.locallocked: |
733 tr = pushop.repo.transaction('push-phase-sync') | 697 tr = pushop.repo.transaction('push-phase-sync') |