[PATCH 4 of 4 V2] sshpeer: add support for request tracing
Boris Feld
boris.feld at octobus.net
Thu Jan 18 05:01:58 EST 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1515757977 0
# Fri Jan 12 11:52:57 2018 +0000
# Node ID 57cc66485a1018184f706eab67fc8fe282a0ee38
# Parent 819cf8cb57745dc0c3f02e9bce062e81a2719a1a
# EXP-Topic exchangedebug
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 57cc66485a10
sshpeer: add support for request tracing
The new 'devel.debug.peer-request' option now also display some information
about request going through ssh peer.
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -283,6 +283,17 @@ class sshpeer(wireproto.wirepeer):
def _callstream(self, cmd, **args):
args = pycompat.byteskwargs(args)
+ if (self.ui.debugflag
+ and self.ui.configbool('devel', 'debug.peer-request')):
+ dbg = self.ui.debug
+ line = 'devel-peer-request: %s\n'
+ dbg(line % cmd)
+ for key, value in sorted(args.items()):
+ if not isinstance(value, dict):
+ dbg(line % ' %s: %d bytes' % (key, len(value)))
+ else:
+ for dk, dv in sorted(value.items()):
+ dbg(line % ' %s-%s: %d' % (key, dk, len(dv)))
self.ui.debug("sending %s command\n" % cmd)
self._pipeo.write("%s\n" % cmd)
_func, names = wireproto.commands[cmd]
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -478,19 +478,32 @@ stderr from remote commands should be pr
debug output
- $ hg pull --debug ssh://user@dummy/remote
+ $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes
pulling from ssh://user@dummy/remote
running .* ".*/dummyssh" ['"]user at dummy['"] ('|")hg -R remote serve --stdio('|") (re)
+ devel-peer-request: hello
sending hello command
+ devel-peer-request: between
+ devel-peer-request: pairs: 81 bytes
sending between command
remote: 384
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
remote: 1
query 1; heads
+ devel-peer-request: batch
+ devel-peer-request: cmds: 141 bytes
sending batch command
searching for changes
all remote heads known locally
no changes found
+ devel-peer-request: getbundle
+ devel-peer-request: bookmarks: 1 bytes
+ devel-peer-request: bundlecaps: 233 bytes
+ devel-peer-request: cg: 1 bytes
+ devel-peer-request: common: 122 bytes
+ devel-peer-request: heads: 122 bytes
+ devel-peer-request: listkeys: 9 bytes
+ devel-peer-request: phases: 1 bytes
sending getbundle command
bundle2-input-bundle: with-transaction
bundle2-input-part: "bookmarks" supported
More information about the Mercurial-devel
mailing list