comparison mercurial/exchange.py @ 37648:8f3c6fb55369

exchange: use command executor for getbundle The code consuming the bundle has been moved to inside the context manager, as that is supposed to be part of the API. (Although it doesn't matter for version 1 peers.) Differential Revision: https://phab.mercurial-scm.org/D3316
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 11:37:37 -0700
parents 516b5a5edae3
children a168799687e5
comparison
equal deleted inserted replaced
37647:516b5a5edae3 37648:8f3c6fb55369
1646 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps) 1646 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
1647 if obsolete.commonversion(remoteversions) is not None: 1647 if obsolete.commonversion(remoteversions) is not None:
1648 kwargs['obsmarkers'] = True 1648 kwargs['obsmarkers'] = True
1649 pullop.stepsdone.add('obsmarkers') 1649 pullop.stepsdone.add('obsmarkers')
1650 _pullbundle2extraprepare(pullop, kwargs) 1650 _pullbundle2extraprepare(pullop, kwargs)
1651 bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs)) 1651
1652 try: 1652 with pullop.remote.commandexecutor() as e:
1653 op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, 1653 args = dict(kwargs)
1654 source='pull') 1654 args['source'] = 'pull'
1655 op.modes['bookmarks'] = 'records' 1655 bundle = e.callcommand('getbundle', args).result()
1656 bundle2.processbundle(pullop.repo, bundle, op=op) 1656
1657 except bundle2.AbortFromPart as exc: 1657 try:
1658 pullop.repo.ui.status(_('remote: abort: %s\n') % exc) 1658 op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction,
1659 raise error.Abort(_('pull failed on remote'), hint=exc.hint) 1659 source='pull')
1660 except error.BundleValueError as exc: 1660 op.modes['bookmarks'] = 'records'
1661 raise error.Abort(_('missing support for %s') % exc) 1661 bundle2.processbundle(pullop.repo, bundle, op=op)
1662 except bundle2.AbortFromPart as exc:
1663 pullop.repo.ui.status(_('remote: abort: %s\n') % exc)
1664 raise error.Abort(_('pull failed on remote'), hint=exc.hint)
1665 except error.BundleValueError as exc:
1666 raise error.Abort(_('missing support for %s') % exc)
1662 1667
1663 if pullop.fetch: 1668 if pullop.fetch:
1664 pullop.cgresult = bundle2.combinechangegroupresults(op) 1669 pullop.cgresult = bundle2.combinechangegroupresults(op)
1665 1670
1666 # processing phases change 1671 # processing phases change