Patchwork D3314: wireproto: use command executor for unbundle

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 10:20 p.m.
Message ID <44a080dd48962e199d34a9db9055daff@localhost.localdomain>
Download mbox | patch
Permalink /patch/30928/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 10:20 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG72e26319f3b8: wireproto: use command executor for unbundle (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3314?vs=8134&id=8182

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

AFFECTED FILES
  mercurial/exchange.py
  mercurial/localrepo.py
  mercurial/wireprotov1peer.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -436,7 +436,7 @@ 
         else:
             return changegroupmod.cg1unpacker(f, 'UN')
 
-    def unbundle(self, cg, heads, url):
+    def unbundle(self, bundle, heads, url):
         '''Send cg (a readable file-like object representing the
         changegroup to push, typically a chunkbuffer object) to the
         remote server as a bundle.
@@ -456,9 +456,9 @@ 
         else:
             heads = wireprototypes.encodelist(heads)
 
-        if util.safehasattr(cg, 'deltaheader'):
+        if util.safehasattr(bundle, 'deltaheader'):
             # this a bundle10, do the old style call sequence
-            ret, output = self._callpush("unbundle", cg, heads=heads)
+            ret, output = self._callpush("unbundle", bundle, heads=heads)
             if ret == "":
                 raise error.ResponseError(
                     _('push failed:'), output)
@@ -472,7 +472,7 @@ 
                 self.ui.status(_('remote: '), l)
         else:
             # bundle2 push. Send a stream, fetch a stream.
-            stream = self._calltwowaystream('unbundle', cg, heads=heads)
+            stream = self._calltwowaystream('unbundle', bundle, heads=heads)
             ret = bundle2.getunbundler(self.ui, stream)
         return ret
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -275,14 +275,14 @@ 
         raise error.Abort(_('cannot perform stream clone against local '
                             'peer'))
 
-    def unbundle(self, cg, heads, url):
+    def unbundle(self, bundle, heads, url):
         """apply a bundle on a repo
 
         This function handles the repo locking itself."""
         try:
             try:
-                cg = exchange.readbundle(self.ui, cg, None)
-                ret = exchange.unbundle(self._repo, cg, heads, 'push', url)
+                bundle = exchange.readbundle(self.ui, bundle, None)
+                ret = exchange.unbundle(self._repo, bundle, heads, 'push', url)
                 if util.safehasattr(ret, 'getchunks'):
                     # This is a bundle20 object, turn it into an unbundler.
                     # This little dance should be dropped eventually when the
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1096,8 +1096,12 @@ 
     stream = util.chunkbuffer(bundler.getchunks())
     try:
         try:
-            reply = pushop.remote.unbundle(
-                stream, ['force'], pushop.remote.url())
+            with pushop.remote.commandexecutor() as e:
+                reply = e.callcommand('unbundle', {
+                    'bundle': stream,
+                    'heads': ['force'],
+                    'url': pushop.remote.url(),
+                }).result()
         except error.BundleValueError as exc:
             raise error.Abort(_('missing support for %s') % exc)
         try: