D3317: wireproto: properly call clonebundles command

2018-04-13 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa168799687e5: wireproto: properly call clonebundles command 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3317?vs=8137=8185

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

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

CHANGE DETAILS

diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -322,6 +322,10 @@
 
 # Begin of ipeercommands interface.
 
+def clonebundles(self):
+self.requirecap('clonebundles', _('clone bundles'))
+return self._call('clonebundles')
+
 @batchable
 def lookup(self, key):
 self.requirecap('lookup', _('look up remote revision'))
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -101,6 +101,12 @@
 Returns a set of string capabilities.
 """
 
+def clonebundles():
+"""Obtains the clone bundles manifest for the repo.
+
+Returns the manifest as unparsed bytes.
+"""
+
 def debugwireargs(one, two, three=None, four=None, five=None):
 """Used to facilitate debugging of arguments passed over the wire."""
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -235,6 +235,9 @@
 def capabilities(self):
 return self._caps
 
+def clonebundles(self):
+return self._repo.tryread('clonebundles.manifest')
+
 def debugwireargs(self, one, two, three=None, four=None, five=None):
 """Used to test argument passing over the wire"""
 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2170,7 +2170,8 @@
 if not remote.capable('clonebundles'):
 return
 
-res = remote._call('clonebundles')
+with remote.commandexecutor() as e:
+res = e.callcommand('clonebundles', {}).result()
 
 # If we call the wire protocol command, that's good enough to record the
 # attempt.



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


D3317: wireproto: properly call clonebundles command

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
  We should not be using _call() to make wire protocol calls because
  it isn't part of the peer API.
  
  But clonebundles wasn't part of the supported commands in the
  peer API!
  
  So this commit defines that command in the commands interface,
  implements it, and teaches the one caller in core to call it using
  the command executor interface.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -322,6 +322,10 @@
 
 # Begin of ipeercommands interface.
 
+def clonebundles(self):
+self.requirecap('clonebundles', _('clone bundles'))
+return self._call('clonebundles')
+
 @batchable
 def lookup(self, key):
 self.requirecap('lookup', _('look up remote revision'))
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -101,6 +101,12 @@
 Returns a set of string capabilities.
 """
 
+def clonebundles():
+"""Obtains the clone bundles manifest for the repo.
+
+Returns the manifest as unparsed bytes.
+"""
+
 def debugwireargs(one, two, three=None, four=None, five=None):
 """Used to facilitate debugging of arguments passed over the wire."""
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -235,6 +235,9 @@
 def capabilities(self):
 return self._caps
 
+def clonebundles(self):
+return self._repo.tryread('clonebundles.manifest')
+
 def debugwireargs(self, one, two, three=None, four=None, five=None):
 """Used to test argument passing over the wire"""
 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2170,7 +2170,8 @@
 if not remote.capable('clonebundles'):
 return
 
-res = remote._call('clonebundles')
+with remote.commandexecutor() as e:
+res = e.callcommand('clonebundles', {}).result()
 
 # If we call the wire protocol command, that's good enough to record the
 # attempt.



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