comparison mercurial/bundlerepo.py @ 37643:1aa4d646d0de

bundlerepo: use command executor for wire protocol commands Differential Revision: https://phab.mercurial-scm.org/D3294
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 11:21:55 -0700
parents d959277ff1b5
children 0664be4f0c1f
comparison
equal deleted inserted replaced
37642:d959277ff1b5 37643:1aa4d646d0de
538 forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc 538 forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc
539 canbundle2 = (not forcebundle1 539 canbundle2 = (not forcebundle1
540 and peer.capable('getbundle') 540 and peer.capable('getbundle')
541 and peer.capable('bundle2')) 541 and peer.capable('bundle2'))
542 if canbundle2: 542 if canbundle2:
543 kwargs = {} 543 with peer.commandexecutor() as e:
544 kwargs[r'common'] = common 544 b2 = e.callcommand('getbundle', {
545 kwargs[r'heads'] = rheads 545 'source': 'incoming',
546 kwargs[r'bundlecaps'] = exchange.caps20to10(repo, role='client') 546 'common': common,
547 kwargs[r'cg'] = True 547 'heads': rheads,
548 b2 = peer.getbundle('incoming', **kwargs) 548 'bundlecaps': exchange.caps20to10(repo, role='client'),
549 fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(), 549 'cg': True,
550 bundlename) 550 }).result()
551
552 fname = bundle = changegroup.writechunks(ui,
553 b2._forwardchunks(),
554 bundlename)
551 else: 555 else:
552 if peer.capable('getbundle'): 556 if peer.capable('getbundle'):
553 cg = peer.getbundle('incoming', common=common, heads=rheads) 557 with peer.commandexecutor() as e:
558 cg = e.callcommand('getbundle', {
559 'source': 'incoming',
560 'common': common,
561 'heads': rheads,
562 }).result()
554 elif onlyheads is None and not peer.capable('changegroupsubset'): 563 elif onlyheads is None and not peer.capable('changegroupsubset'):
555 # compat with older servers when pulling all remote heads 564 # compat with older servers when pulling all remote heads
556 565
557 with peer.commandexecutor() as e: 566 with peer.commandexecutor() as e:
558 cg = e.callcommand('changegroup', { 567 cg = e.callcommand('changegroup', {
592 601
593 csets = localrepo.changelog.findmissing(common, rheads) 602 csets = localrepo.changelog.findmissing(common, rheads)
594 603
595 if bundlerepo: 604 if bundlerepo:
596 reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]] 605 reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]]
597 remotephases = peer.listkeys('phases') 606
607 with peer.commandexecutor() as e:
608 remotephases = e.callcommand('listkeys', {
609 'namespace': 'phases',
610 }).result()
598 611
599 pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes) 612 pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes)
600 pullop.trmanager = bundletransactionmanager() 613 pullop.trmanager = bundletransactionmanager()
601 exchange._pullapplyphases(pullop, remotephases) 614 exchange._pullapplyphases(pullop, remotephases)
602 615