~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: v.ladeuil+lp at free
  • Date: 2007-05-18 18:20:31 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070518182031-gbg2cgidv5l20x9p
Takes Robert comments into account.

* bzrlib/transport/ftp.py:
(FtpTransport.__init__): Write a better explanation.

* bzrlib/tests/test_init.py:
(InstrumentedTransport): Just make hooks a class attribute.
(InstrumentedTransport._get_FTP): Run hook directly in the for
loop.
(TransportHooks.run_hook, TransportHooks.uninstall_hook): Not
needed. The hooks should be cleaned up by the test itself.
(TestInit.setUp.cleanup): Resset to default hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from cStringIO import StringIO
23
23
 
24
 
from bzrlib import debug
25
24
from bzrlib import errors
26
25
from bzrlib.smart import request
27
 
from bzrlib.trace import mutter
28
26
 
29
27
 
30
28
# Protocol version strings.  These are sent as prefixes of bzr requests and
301
299
        self._body_buffer = None
302
300
 
303
301
    def call(self, *args):
304
 
        if 'hpss' in debug.debug_flags:
305
 
            mutter('hpss call: %r', args)
306
302
        self._write_args(args)
307
303
        self._request.finished_writing()
308
304
 
311
307
 
312
308
        After calling this, call read_response_tuple to find the result out.
313
309
        """
314
 
        if 'hpss' in debug.debug_flags:
315
 
            mutter('hpss call w/body: %r (%r...)', args, body[:20])
316
310
        self._write_args(args)
317
311
        bytes = self._encode_bulk_data(body)
318
312
        self._request.accept_bytes(bytes)
324
318
        The body is encoded with one line per readv offset pair. The numbers in
325
319
        each pair are separated by a comma, and no trailing \n is emitted.
326
320
        """
327
 
        if 'hpss' in debug.debug_flags:
328
 
            mutter('hpss call w/readv: %r', args)
329
321
        self._write_args(args)
330
322
        readv_bytes = self._serialise_offsets(body)
331
323
        bytes = self._encode_bulk_data(readv_bytes)
347
339
        This should only be called once.
348
340
        """
349
341
        result = self._recv_tuple()
350
 
        if 'hpss' in debug.debug_flags:
351
 
            mutter('hpss result: %r', result)
352
342
        if not expect_body:
353
343
            self._request.finished_reading()
354
344
        return result