# HG changeset patch # User Gregory Szorc # Date 1523644657 25200 # Node ID 8f3c6fb55369b92f184994edeb7e1434ad804dd5 # Parent 516b5a5edae3879a9b8edae8e5a594d2fb53b3f0 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 diff -r 516b5a5edae3 -r 8f3c6fb55369 mercurial/exchange.py --- a/mercurial/exchange.py Fri Apr 13 11:45:38 2018 -0700 +++ b/mercurial/exchange.py Fri Apr 13 11:37:37 2018 -0700 @@ -1648,17 +1648,22 @@ kwargs['obsmarkers'] = True pullop.stepsdone.add('obsmarkers') _pullbundle2extraprepare(pullop, kwargs) - bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs)) - try: - op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, - source='pull') - op.modes['bookmarks'] = 'records' - bundle2.processbundle(pullop.repo, bundle, op=op) - except bundle2.AbortFromPart as exc: - pullop.repo.ui.status(_('remote: abort: %s\n') % exc) - raise error.Abort(_('pull failed on remote'), hint=exc.hint) - except error.BundleValueError as exc: - raise error.Abort(_('missing support for %s') % exc) + + with pullop.remote.commandexecutor() as e: + args = dict(kwargs) + args['source'] = 'pull' + bundle = e.callcommand('getbundle', args).result() + + try: + op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, + source='pull') + op.modes['bookmarks'] = 'records' + bundle2.processbundle(pullop.repo, bundle, op=op) + except bundle2.AbortFromPart as exc: + pullop.repo.ui.status(_('remote: abort: %s\n') % exc) + raise error.Abort(_('pull failed on remote'), hint=exc.hint) + except error.BundleValueError as exc: + raise error.Abort(_('missing support for %s') % exc) if pullop.fetch: pullop.cgresult = bundle2.combinechangegroupresults(op)