mercurial/wireprototypes.py
changeset 48946 642e31cb55f0
parent 48875 6000f5b25c9b
child 50913 93b0de7f13ca
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
    37         b'version': 1,
    37         b'version': 1,
    38     },
    38     },
    39 }
    39 }
    40 
    40 
    41 
    41 
    42 class bytesresponse(object):
    42 class bytesresponse:
    43     """A wire protocol response consisting of raw bytes."""
    43     """A wire protocol response consisting of raw bytes."""
    44 
    44 
    45     def __init__(self, data):
    45     def __init__(self, data):
    46         self.data = data
    46         self.data = data
    47 
    47 
    48 
    48 
    49 class ooberror(object):
    49 class ooberror:
    50     """wireproto reply: failure of a batch of operation
    50     """wireproto reply: failure of a batch of operation
    51 
    51 
    52     Something failed during a batch call. The error message is stored in
    52     Something failed during a batch call. The error message is stored in
    53     `self.message`.
    53     `self.message`.
    54     """
    54     """
    55 
    55 
    56     def __init__(self, message):
    56     def __init__(self, message):
    57         self.message = message
    57         self.message = message
    58 
    58 
    59 
    59 
    60 class pushres(object):
    60 class pushres:
    61     """wireproto reply: success with simple integer return
    61     """wireproto reply: success with simple integer return
    62 
    62 
    63     The call was successful and returned an integer contained in `self.res`.
    63     The call was successful and returned an integer contained in `self.res`.
    64     """
    64     """
    65 
    65 
    66     def __init__(self, res, output):
    66     def __init__(self, res, output):
    67         self.res = res
    67         self.res = res
    68         self.output = output
    68         self.output = output
    69 
    69 
    70 
    70 
    71 class pusherr(object):
    71 class pusherr:
    72     """wireproto reply: failure
    72     """wireproto reply: failure
    73 
    73 
    74     The call failed. The `self.res` attribute contains the error message.
    74     The call failed. The `self.res` attribute contains the error message.
    75     """
    75     """
    76 
    76 
    77     def __init__(self, res, output):
    77     def __init__(self, res, output):
    78         self.res = res
    78         self.res = res
    79         self.output = output
    79         self.output = output
    80 
    80 
    81 
    81 
    82 class streamres(object):
    82 class streamres:
    83     """wireproto reply: binary stream
    83     """wireproto reply: binary stream
    84 
    84 
    85     The call was successful and the result is a stream.
    85     The call was successful and the result is a stream.
    86 
    86 
    87     Accepts a generator containing chunks of data to be sent to the client.
    87     Accepts a generator containing chunks of data to be sent to the client.
    94     def __init__(self, gen=None, prefer_uncompressed=False):
    94     def __init__(self, gen=None, prefer_uncompressed=False):
    95         self.gen = gen
    95         self.gen = gen
    96         self.prefer_uncompressed = prefer_uncompressed
    96         self.prefer_uncompressed = prefer_uncompressed
    97 
    97 
    98 
    98 
    99 class streamreslegacy(object):
    99 class streamreslegacy:
   100     """wireproto reply: uncompressed binary stream
   100     """wireproto reply: uncompressed binary stream
   101 
   101 
   102     The call was successful and the result is a stream.
   102     The call was successful and the result is a stream.
   103 
   103 
   104     Accepts a generator containing chunks of data to be sent to the client.
   104     Accepts a generator containing chunks of data to be sent to the client.
   241         doesn't have that permission, the exception should raise or abort
   241         doesn't have that permission, the exception should raise or abort
   242         in a protocol specific manner.
   242         in a protocol specific manner.
   243         """
   243         """
   244 
   244 
   245 
   245 
   246 class commandentry(object):
   246 class commandentry:
   247     """Represents a declared wire protocol command."""
   247     """Represents a declared wire protocol command."""
   248 
   248 
   249     def __init__(
   249     def __init__(
   250         self,
   250         self,
   251         func,
   251         func,
   404 
   404 
   405     return compengines
   405     return compengines
   406 
   406 
   407 
   407 
   408 @attr.s
   408 @attr.s
   409 class encodedresponse(object):
   409 class encodedresponse:
   410     """Represents response data that is already content encoded.
   410     """Represents response data that is already content encoded.
   411 
   411 
   412     Wire protocol version 2 only.
   412     Wire protocol version 2 only.
   413 
   413 
   414     Commands typically emit Python objects that are encoded and sent over the
   414     Commands typically emit Python objects that are encoded and sent over the
   418 
   418 
   419     data = attr.ib()
   419     data = attr.ib()
   420 
   420 
   421 
   421 
   422 @attr.s
   422 @attr.s
   423 class alternatelocationresponse(object):
   423 class alternatelocationresponse:
   424     """Represents a response available at an alternate location.
   424     """Represents a response available at an alternate location.
   425 
   425 
   426     Instances are sent in place of actual response objects when the server
   426     Instances are sent in place of actual response objects when the server
   427     is sending a "content redirect" response.
   427     is sending a "content redirect" response.
   428 
   428 
   437     serverdercerts = attr.ib(default=None)
   437     serverdercerts = attr.ib(default=None)
   438     servercadercerts = attr.ib(default=None)
   438     servercadercerts = attr.ib(default=None)
   439 
   439 
   440 
   440 
   441 @attr.s
   441 @attr.s
   442 class indefinitebytestringresponse(object):
   442 class indefinitebytestringresponse:
   443     """Represents an object to be encoded to an indefinite length bytestring.
   443     """Represents an object to be encoded to an indefinite length bytestring.
   444 
   444 
   445     Instances are initialized from an iterable of chunks, with each chunk being
   445     Instances are initialized from an iterable of chunks, with each chunk being
   446     a bytes instance.
   446     a bytes instance.
   447     """
   447     """