Mercurial > hg
comparison mercurial/debugcommands.py @ 37722:89a16704114c
wireprotov2: define response data as CBOR
Previously, response data was defined as a stream of bytes. We had
the option to declare it as CBOR using a frame flag.
We've converged all wire protocol commands exposed on version 2 to
CBOR. I think consistency is important. The overhead to encoding
things with CBOR is minimal. Even a very large bytestring can be
efficiently encoded using an indefinite length bytestring. Now,
there are limitations with consumers not being able to efficiently
stream large CBOR values. But these feel like solvable problems.
This commit removes the "is CBOR" frame flag from command response
frames and defines the frame as always consisting of a stream of
CBOR values.
The framing protocol media type has been bumped to reflect this
BC change.
Differential Revision: https://phab.mercurial-scm.org/D3382
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 14 Apr 2018 12:07:31 -0700 |
parents | d715a85003c8 |
children | 0e9ddab2bac2 |
comparison
equal
deleted
inserted
replaced
37721:f7673845b167 | 37722:89a16704114c |
---|---|
3012 else: | 3012 else: |
3013 with peer.commandexecutor() as e: | 3013 with peer.commandexecutor() as e: |
3014 res = e.callcommand(command, args).result() | 3014 res = e.callcommand(command, args).result() |
3015 | 3015 |
3016 if isinstance(res, wireprotov2peer.commandresponse): | 3016 if isinstance(res, wireprotov2peer.commandresponse): |
3017 if res.cbor: | 3017 val = list(res.cborobjects()) |
3018 val = list(res.cborobjects()) | |
3019 else: | |
3020 val = [res.b.getvalue()] | |
3021 | |
3022 ui.status(_('response: %s\n') % stringutil.pprint(val)) | 3018 ui.status(_('response: %s\n') % stringutil.pprint(val)) |
3023 | 3019 |
3024 else: | 3020 else: |
3025 ui.status(_('response: %s\n') % stringutil.pprint(res)) | 3021 ui.status(_('response: %s\n') % stringutil.pprint(res)) |
3026 | 3022 |