Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
37717:0664be4f0c1f | 37718:ad1c07008e0b |
---|---|
2624 @command('debugwireproto', | 2624 @command('debugwireproto', |
2625 [ | 2625 [ |
2626 ('', 'localssh', False, _('start an SSH server for this repo')), | 2626 ('', 'localssh', False, _('start an SSH server for this repo')), |
2627 ('', 'peer', '', _('construct a specific version of the peer')), | 2627 ('', 'peer', '', _('construct a specific version of the peer')), |
2628 ('', 'noreadstderr', False, _('do not read from stderr of the remote')), | 2628 ('', 'noreadstderr', False, _('do not read from stderr of the remote')), |
2629 ('', 'nologhandshake', False, | |
2630 _('do not log I/O related to the peer handshake')), | |
2629 ] + cmdutil.remoteopts, | 2631 ] + cmdutil.remoteopts, |
2630 _('[PATH]'), | 2632 _('[PATH]'), |
2631 optionalrepo=True) | 2633 optionalrepo=True) |
2632 def debugwireproto(ui, repo, path=None, **opts): | 2634 def debugwireproto(ui, repo, path=None, **opts): |
2633 """send wire protocol commands to a server | 2635 """send wire protocol commands to a server |
2919 ui.write(_('creating http peer for wire protocol version 2\n')) | 2921 ui.write(_('creating http peer for wire protocol version 2\n')) |
2920 # We go through makepeer() because we need an API descriptor for | 2922 # We go through makepeer() because we need an API descriptor for |
2921 # the peer instance to be useful. | 2923 # the peer instance to be useful. |
2922 with ui.configoverride({ | 2924 with ui.configoverride({ |
2923 ('experimental', 'httppeer.advertise-v2'): True}): | 2925 ('experimental', 'httppeer.advertise-v2'): True}): |
2926 if opts['nologhandshake']: | |
2927 ui.pushbuffer() | |
2928 | |
2924 peer = httppeer.makepeer(ui, path, opener=opener) | 2929 peer = httppeer.makepeer(ui, path, opener=opener) |
2930 | |
2931 if opts['nologhandshake']: | |
2932 ui.popbuffer() | |
2925 | 2933 |
2926 if not isinstance(peer, httppeer.httpv2peer): | 2934 if not isinstance(peer, httppeer.httpv2peer): |
2927 raise error.Abort(_('could not instantiate HTTP peer for ' | 2935 raise error.Abort(_('could not instantiate HTTP peer for ' |
2928 'wire protocol version 2'), | 2936 'wire protocol version 2'), |
2929 hint=_('the server may not have the feature ' | 2937 hint=_('the server may not have the feature ' |