D3316: exchange: use command executor for getbundle

2018-04-13 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8f3c6fb55369: exchange: use command executor for getbundle 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3316?vs=8136&id=8184

REVISION DETAIL
  https://phab.mercurial-scm.org/D3316

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -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)



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3316: exchange: use command executor for getbundle

2018-04-13 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3316

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -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)



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel