Rev 2595: (Andrew Bennetts) Add -Dhpss debug flag to trace smart protocol requests and responses. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 9 09:29:35 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2595
revision-id: pqm at pqm.ubuntu.com-20070709082933-8p7ogzcqmw9pnfdz
parent: pqm at pqm.ubuntu.com-20070709055735-nechlzumkvkl2woi
parent: andrew.bennetts at canonical.com-20070709055641-fy6ef6m7cw1ifrxj
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-07-09 09:29:33 +0100
message:
  (Andrew Bennetts) Add -Dhpss debug flag to trace smart protocol requests and responses.
modified:
  bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
  bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
    ------------------------------------------------------------
    revno: 2593.3.2
    merged: andrew.bennetts at canonical.com-20070709055641-fy6ef6m7cw1ifrxj
    parent: andrew.bennetts at canonical.com-20070709043130-ur99iy0a2otc6sfc
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: hpss-debug-flag
    timestamp: Mon 2007-07-09 15:56:41 +1000
    message:
      Make -Dhpss use mutter instead of note to be consistent with other debug_flags.
    ------------------------------------------------------------
    revno: 2593.3.1
    merged: andrew.bennetts at canonical.com-20070709043130-ur99iy0a2otc6sfc
    parent: pqm at pqm.ubuntu.com-20070706141845-sije5bdx8pjw2fhk
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: hpss-debug-flag
    timestamp: Mon 2007-07-09 14:31:30 +1000
    message:
      Add a -Dhpss debug flag.
=== modified file 'bzrlib/debug.py'
--- a/bzrlib/debug.py	2007-07-04 09:24:14 +0000
+++ b/bzrlib/debug.py	2007-07-09 04:31:30 +0000
@@ -22,8 +22,9 @@
 
 Options include:
     
+ * error - show stack traces for all top level exceptions
  * hooks 
+ * hpss - trace smart protocol requests and responses
  * lock - trace when lockdir locks are taken or released
- * error - show stack traces for all top level exceptions
 
 """

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2007-04-26 06:01:31 +0000
+++ b/bzrlib/smart/protocol.py	2007-07-09 05:56:41 +0000
@@ -21,8 +21,10 @@
 
 from cStringIO import StringIO
 
+from bzrlib import debug
 from bzrlib import errors
 from bzrlib.smart import request
+from bzrlib.trace import mutter
 
 
 # Protocol version strings.  These are sent as prefixes of bzr requests and
@@ -299,6 +301,8 @@
         self._body_buffer = None
 
     def call(self, *args):
+        if 'hpss' in debug.debug_flags:
+            mutter('hpss call: %r', args)
         self._write_args(args)
         self._request.finished_writing()
 
@@ -307,6 +311,8 @@
 
         After calling this, call read_response_tuple to find the result out.
         """
+        if 'hpss' in debug.debug_flags:
+            mutter('hpss call w/body: %r (%r...)', args, body[:20])
         self._write_args(args)
         bytes = self._encode_bulk_data(body)
         self._request.accept_bytes(bytes)
@@ -318,6 +324,8 @@
         The body is encoded with one line per readv offset pair. The numbers in
         each pair are separated by a comma, and no trailing \n is emitted.
         """
+        if 'hpss' in debug.debug_flags:
+            mutter('hpss call w/readv: %r', args)
         self._write_args(args)
         readv_bytes = self._serialise_offsets(body)
         bytes = self._encode_bulk_data(readv_bytes)
@@ -339,6 +347,8 @@
         This should only be called once.
         """
         result = self._recv_tuple()
+        if 'hpss' in debug.debug_flags:
+            mutter('hpss result: %r', result)
         if not expect_body:
             self._request.finished_reading()
         return result




More information about the bazaar-commits mailing list