[PATCH] peer-request: include more details about batch commands

Boris Feld boris.feld at octobus.net
Tue Mar 13 16:39:19 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1520268508 18000
#      Mon Mar 05 11:48:28 2018 -0500
# Node ID 025b0a829b1c9a299b76b7303b4d46c269fcba48
# Parent  31581528f2421dc5d8a567125b8ecc0367b2b906
# EXP-Topic peer-request.batch
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 025b0a829b1c
peer-request: include more details about batch commands

A batch commands encapsulate multiple other commands. We display a bit more
details about what is actually batched if peer request tracking is set.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -400,6 +400,13 @@ class wirepeer(repository.legacypeer):
 
         Returns an iterator of the raw responses from the server.
         """
+        ui = self.ui
+        if ui.debugflag and ui.configbool('devel', 'debug.peer-request'):
+            ui.debug('devel-peer-request: batched-content\n')
+            for op, args in req:
+                msg = 'devel-peer-request:    - %s (%d arguments)\n'
+                ui.debug(msg % (op, len(args)))
+
         rsp = self._callstream("batch", cmds=encodebatchcmds(req))
         chunk = rsp.read(1024)
         work = [chunk]
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -257,6 +257,9 @@ test http authentication
   http auth: user user, password ****
   devel-peer-request:   finished in *.???? seconds (200) (glob)
   query 1; heads
+  devel-peer-request: batched-content
+  devel-peer-request:    - heads (0 arguments)
+  devel-peer-request:    - known (1 arguments)
   sending batch command
   devel-peer-request: GET http://localhost:$HGPORT2/?cmd=batch
   devel-peer-request:   Vary X-HgArg-1,X-HgProto-1
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -501,6 +501,9 @@ debug output
   remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
   remote: 1 (sshv1 !)
   query 1; heads
+  devel-peer-request: batched-content
+  devel-peer-request:    - heads (0 arguments)
+  devel-peer-request:    - known (1 arguments)
   devel-peer-request: batch
   devel-peer-request:   cmds: 141 bytes
   sending batch command


More information about the Mercurial-devel mailing list