--- a/mercurial/wireproto.py Fri Mar 28 12:29:34 2014 -0700
+++ b/mercurial/wireproto.py Fri Mar 28 14:24:13 2014 -0700
@@ -314,16 +314,16 @@
def changegroup(self, nodes, kind):
n = encodelist(nodes)
- f = self._callstream("changegroup", roots=n)
- return changegroupmod.unbundle10(self._decompress(f), 'UN')
+ f = self._callcompressable("changegroup", roots=n)
+ return changegroupmod.unbundle10(f, 'UN')
def changegroupsubset(self, bases, heads, kind):
self.requirecap('changegroupsubset', _('look up remote changes'))
bases = encodelist(bases)
heads = encodelist(heads)
- f = self._callstream("changegroupsubset",
- bases=bases, heads=heads)
- return changegroupmod.unbundle10(self._decompress(f), 'UN')
+ f = self._callcompressable("changegroupsubset",
+ bases=bases, heads=heads)
+ return changegroupmod.unbundle10(f, 'UN')
def getbundle(self, source, heads=None, common=None, bundlecaps=None):
self.requirecap('getbundle', _('look up remote changes'))
@@ -334,8 +334,8 @@
opts['common'] = encodelist(common)
if bundlecaps is not None:
opts['bundlecaps'] = ','.join(bundlecaps)
- f = self._callstream("getbundle", **opts)
- return changegroupmod.unbundle10(self._decompress(f), 'UN')
+ f = self._callcompressable("getbundle", **opts)
+ return changegroupmod.unbundle10(f, 'UN')
def unbundle(self, cg, heads, source):
'''Send cg (a readable file-like object representing the
@@ -388,6 +388,19 @@
returns the server reply as a file like object."""
raise NotImplementedError()
+ def _callcompressable(self, cmd, **args):
+ """execute <cmd> on the server
+
+ The command is expected to return a stream.
+
+ The stream may have been compressed in some implementaitons. This
+ function takes care of the decompression. This is the only difference
+ with _callstream.
+
+ returns the server reply as a file like object.
+ """
+ raise NotImplementedError()
+
def _callpush(self, cmd, fp, **args):
"""execute a <cmd> on server
@@ -404,12 +417,6 @@
"""
raise NotImplementedError()
-
- def _decompress(self, stream):
- """decompress a received stream
- """
- raise NotImplementedError()
-
# server side
# wire protocol command can either return a string or one of these classes.