Show More
@@ -211,10 +211,8 b' class httppeer(wireproto.wirepeer):' | |||
|
211 | 211 | fp.close() |
|
212 | 212 | os.unlink(tempname) |
|
213 | 213 | |
|
214 | def _abort(self, exception): | |
|
215 | raise exception | |
|
216 | ||
|
217 | def _decompress(self, stream): | |
|
214 | def _callcompressable(self, cmd, **args): | |
|
215 | stream = self._callstream(cmd, **args) | |
|
218 | 216 | return util.chunkbuffer(zgenerator(stream)) |
|
219 | 217 | |
|
220 | 218 | class httpspeer(httppeer): |
@@ -157,6 +157,9 b' class sshpeer(wireproto.wirepeer):' | |||
|
157 | 157 | |
|
158 | 158 | return self.pipei |
|
159 | 159 | |
|
160 | def _callcompressable(self, cmd, **args): | |
|
161 | return self._callstream(cmd, **args) | |
|
162 | ||
|
160 | 163 | def _call(self, cmd, **args): |
|
161 | 164 | self._callstream(cmd, **args) |
|
162 | 165 | return self._recv() |
@@ -176,8 +179,6 b' class sshpeer(wireproto.wirepeer):' | |||
|
176 | 179 | return '', r |
|
177 | 180 | return self._recv(), '' |
|
178 | 181 | |
|
179 | def _decompress(self, stream): | |
|
180 | return stream | |
|
181 | 182 | |
|
182 | 183 | def _recv(self): |
|
183 | 184 | l = self.pipei.readline() |
@@ -314,16 +314,16 b' class wirepeer(peer.peerrepository):' | |||
|
314 | 314 | |
|
315 | 315 | def changegroup(self, nodes, kind): |
|
316 | 316 | n = encodelist(nodes) |
|
317 |
f = self._call |
|
|
318 |
return changegroupmod.unbundle10( |
|
|
317 | f = self._callcompressable("changegroup", roots=n) | |
|
318 | return changegroupmod.unbundle10(f, 'UN') | |
|
319 | 319 | |
|
320 | 320 | def changegroupsubset(self, bases, heads, kind): |
|
321 | 321 | self.requirecap('changegroupsubset', _('look up remote changes')) |
|
322 | 322 | bases = encodelist(bases) |
|
323 | 323 | heads = encodelist(heads) |
|
324 |
f = self._call |
|
|
325 | bases=bases, heads=heads) | |
|
326 |
return changegroupmod.unbundle10( |
|
|
324 | f = self._callcompressable("changegroupsubset", | |
|
325 | bases=bases, heads=heads) | |
|
326 | return changegroupmod.unbundle10(f, 'UN') | |
|
327 | 327 | |
|
328 | 328 | def getbundle(self, source, heads=None, common=None, bundlecaps=None): |
|
329 | 329 | self.requirecap('getbundle', _('look up remote changes')) |
@@ -334,8 +334,8 b' class wirepeer(peer.peerrepository):' | |||
|
334 | 334 | opts['common'] = encodelist(common) |
|
335 | 335 | if bundlecaps is not None: |
|
336 | 336 | opts['bundlecaps'] = ','.join(bundlecaps) |
|
337 |
f = self._call |
|
|
338 |
return changegroupmod.unbundle10( |
|
|
337 | f = self._callcompressable("getbundle", **opts) | |
|
338 | return changegroupmod.unbundle10(f, 'UN') | |
|
339 | 339 | |
|
340 | 340 | def unbundle(self, cg, heads, source): |
|
341 | 341 | '''Send cg (a readable file-like object representing the |
@@ -388,6 +388,19 b' class wirepeer(peer.peerrepository):' | |||
|
388 | 388 | returns the server reply as a file like object.""" |
|
389 | 389 | raise NotImplementedError() |
|
390 | 390 | |
|
391 | def _callcompressable(self, cmd, **args): | |
|
392 | """execute <cmd> on the server | |
|
393 | ||
|
394 | The command is expected to return a stream. | |
|
395 | ||
|
396 | The stream may have been compressed in some implementaitons. This | |
|
397 | function takes care of the decompression. This is the only difference | |
|
398 | with _callstream. | |
|
399 | ||
|
400 | returns the server reply as a file like object. | |
|
401 | """ | |
|
402 | raise NotImplementedError() | |
|
403 | ||
|
391 | 404 | def _callpush(self, cmd, fp, **args): |
|
392 | 405 | """execute a <cmd> on server |
|
393 | 406 | |
@@ -404,12 +417,6 b' class wirepeer(peer.peerrepository):' | |||
|
404 | 417 | """ |
|
405 | 418 | raise NotImplementedError() |
|
406 | 419 | |
|
407 | ||
|
408 | def _decompress(self, stream): | |
|
409 | """decompress a received stream | |
|
410 | """ | |
|
411 | raise NotImplementedError() | |
|
412 | ||
|
413 | 420 | # server side |
|
414 | 421 | |
|
415 | 422 | # wire protocol command can either return a string or one of these classes. |
General Comments 0
You need to be logged in to leave comments.
Login now