Mercurial > hg
comparison mercurial/debugcommands.py @ 37652:fe8c6f9f2914
debugcommands: use command executor for invoking commands
Now that all peers support the command executor interface, we
can use it in place of peer._call() (which isn't part of the public
API).
Tests changed because we are now returning the decoded response
instead of the raw bytes. The raw bytes over the wire are already
logged. So we're not losing any test coverage. In fact, we're adding
test coverage because we're testing decoding of those command
responses as well.
Differential Revision: https://phab.mercurial-scm.org/D3298
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 13 Apr 2018 12:31:34 -0700 |
parents | 516b5a5edae3 |
children | ad1c07008e0b |
comparison
equal
deleted
inserted
replaced
37651:950294e28136 | 37652:fe8c6f9f2914 |
---|---|
2999 **pycompat.strkwargs(args)) | 2999 **pycompat.strkwargs(args)) |
3000 ui.status(_('result: %s\n') % stringutil.escapestr(res)) | 3000 ui.status(_('result: %s\n') % stringutil.escapestr(res)) |
3001 ui.status(_('remote output: %s\n') % | 3001 ui.status(_('remote output: %s\n') % |
3002 stringutil.escapestr(output)) | 3002 stringutil.escapestr(output)) |
3003 else: | 3003 else: |
3004 res = peer._call(command, **pycompat.strkwargs(args)) | 3004 with peer.commandexecutor() as e: |
3005 res = e.callcommand(command, args).result() | |
3006 | |
3005 ui.status(_('response: %s\n') % stringutil.pprint(res)) | 3007 ui.status(_('response: %s\n') % stringutil.pprint(res)) |
3006 | 3008 |
3007 elif action == 'batchbegin': | 3009 elif action == 'batchbegin': |
3008 if batchedcommands is not None: | 3010 if batchedcommands is not None: |
3009 raise error.Abort(_('nested batchbegin not allowed')) | 3011 raise error.Abort(_('nested batchbegin not allowed')) |