changeset 20902:1e4fda2f5cf1

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Mar 2014 11:37:42 -0700
parents a26dfa7f534c
children 8d477543882b
files mercurial/wireproto.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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