# HG changeset patch # User Pierre-Yves David # Date 1396031862 25200 # Node ID 1e4fda2f5cf14fab3413941ef2eb3f823e78f273 # Parent a26dfa7f534c1e293a9a79b0a78726ab275d9d3e wireproto: document possible return type The wireprotocole command use a small set of class as return value. We document the meaning of each of them. AS my knowledge of wire protocol is fairly shallow, the documentation can probably use improvement. But this is a better than nothing. diff -r a26dfa7f534c -r 1e4fda2f5cf1 mercurial/wireproto.py --- a/mercurial/wireproto.py Tue Apr 01 18:56:19 2014 -0700 +++ b/mercurial/wireproto.py Fri Mar 28 11:37:42 2014 -0700 @@ -327,19 +327,38 @@ # server side +# wire protocol command can either return a string or one of these classes. class streamres(object): + """wireproto reply: binary stream + + The call was successful and the result is a stream. + Iterate on the `self.gen` attribute to retrieve chunks. + """ def __init__(self, gen): self.gen = gen class pushres(object): + """wireproto reply: success with simple integer return + + The call was successful and returned an integer contained in `self.res`. + """ def __init__(self, res): self.res = res class pusherr(object): + """wireproto reply: failure + + The call failed. The `self.res` attribute contains the error message. + """ def __init__(self, res): self.res = res class ooberror(object): + """wireproto reply: failure of a batch of operation + + Something failed during a batch call. The error message is stored in + `self.message`. + """ def __init__(self, message): self.message = message