~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Aaron Bentley
  • Date: 2007-07-17 13:27:14 UTC
  • mfrom: (2624 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070717132714-tmzx9khmg9501k51
Merge from bzr.dev

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