diff mercurial/debugcommands.py @ 37718:ad1c07008e0b

debugcommands: ability to suppress logging of handshake The tests for calling wire protocol commands were getting quite verbose because they included the results of the capabilities request. Furthermore, it was annoying to have to update several tests every time the capabilities response changed. The only tests that really care about the low-level details of the capabilities requests are those testing the protocol handshake. And those are mostly not instantiating peer instances or are contained to limited files. This commit adds an option to `hg debugwireproto` to suppress logging of the handshake. The shell helper function to perform HTTP tests has been updated to use this by default. Lots of excessive test output has gone away. Differential Revision: https://phab.mercurial-scm.org/D3378
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 11:49:57 -0700
parents fe8c6f9f2914
children d715a85003c8
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Apr 14 09:57:44 2018 -0700
+++ b/mercurial/debugcommands.py	Sat Apr 14 11:49:57 2018 -0700
@@ -2626,6 +2626,8 @@
         ('', 'localssh', False, _('start an SSH server for this repo')),
         ('', 'peer', '', _('construct a specific version of the peer')),
         ('', 'noreadstderr', False, _('do not read from stderr of the remote')),
+        ('', 'nologhandshake', False,
+         _('do not log I/O related to the peer handshake')),
     ] + cmdutil.remoteopts,
     _('[PATH]'),
     optionalrepo=True)
@@ -2921,8 +2923,14 @@
             # the peer instance to be useful.
             with ui.configoverride({
                 ('experimental', 'httppeer.advertise-v2'): True}):
+                if opts['nologhandshake']:
+                    ui.pushbuffer()
+
                 peer = httppeer.makepeer(ui, path, opener=opener)
 
+                if opts['nologhandshake']:
+                    ui.popbuffer()
+
             if not isinstance(peer, httppeer.httpv2peer):
                 raise error.Abort(_('could not instantiate HTTP peer for '
                                     'wire protocol version 2'),