Mercurial > public > mercurial-scm > hg
diff mercurial/wireprototypes.py @ 37728:564a3eec6e63
wireprotov2: add support for more response types
This adds types to represent error and generator responses from
server commands.
Differential Revision: https://phab.mercurial-scm.org/D3388
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 15 Apr 2018 10:37:29 -0700 |
parents | 77c9ee77687c |
children | 352932a11905 |
line wrap: on
line diff
--- a/mercurial/wireprototypes.py Sat Apr 14 15:38:11 2018 -0700 +++ b/mercurial/wireprototypes.py Sun Apr 15 10:37:29 2018 -0700 @@ -106,6 +106,22 @@ def __init__(self, v): self.value = v +class v2errorresponse(object): + """Represents a command error for version 2 transports.""" + def __init__(self, message, args=None): + self.message = message + self.args = args + +class v2streamingresponse(object): + """A response whose data is supplied by a generator. + + The generator can either consist of data structures to CBOR + encode or a stream of already-encoded bytes. + """ + def __init__(self, gen, compressible=True): + self.gen = gen + self.compressible = compressible + # list of nodes encoding / decoding def decodelist(l, sep=' '): if l: