Patchwork [01,of,22] wireproto: document possible return type

login
register
mail settings
Submitter Pierre-Yves David
Date March 28, 2014, 10:40 p.m.
Message ID <a403855f263738815a7f.1396046427@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4121/
State Accepted
Commit 1e4fda2f5cf14fab3413941ef2eb3f823e78f273
Headers show

Comments

Pierre-Yves David - March 28, 2014, 10:40 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1396031862 25200
#      Fri Mar 28 11:37:42 2014 -0700
# Node ID a403855f263738815a7fcc131a0588d742b5f273
# Parent  1dc36565b5cc56e71f8e5a5ac5f97fdd85a4496d
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.
Durham Goode - April 3, 2014, 1:48 a.m.
On 3/28/14 3:40 PM, "pierre-yves.david@ens-lyon.org"
<pierre-yves.david@ens-lyon.org> wrote:

># HG changeset patch
># User Pierre-Yves David <pierre-yves.david@fb.com>
># Date 1396031862 25200
>#      Fri Mar 28 11:37:42 2014 -0700
># Node ID a403855f263738815a7fcc131a0588d742b5f273
># Parent  1dc36565b5cc56e71f8e5a5ac5f97fdd85a4496d
>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.

This series looks good to me.

I have a version where I fixed up some grammar, but I can't fb-crew it due
to permissions issues.  Matt you can pull it from @ on my server if you
get to it before dsop fixes the permissions tomorrow.
Pierre-Yves David - April 3, 2014, 1:49 a.m.
On 04/02/2014 06:48 PM, Durham Goode wrote:
> On 3/28/14 3:40 PM, "pierre-yves.david@ens-lyon.org"
> <pierre-yves.david@ens-lyon.org> wrote:
>
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1396031862 25200
>> #      Fri Mar 28 11:37:42 2014 -0700
>> # Node ID a403855f263738815a7fcc131a0588d742b5f273
>> # Parent  1dc36565b5cc56e71f8e5a5ac5f97fdd85a4496d
>> 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.
>
> This series looks good to me.
>
> I have a version where I fixed up some grammar, but I can't fb-crew it due
> to permissions issues.  Matt you can pull it from @ on my server if you
> get to it before dsop fixes the permissions tomorrow.

The permission should have been fixed now.
Durham Goode - April 3, 2014, 4:52 p.m.
On 4/2/14 6:49 PM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
wrote:

>
>
>On 04/02/2014 06:48 PM, Durham Goode wrote:
>> On 3/28/14 3:40 PM, "pierre-yves.david@ens-lyon.org"
>> <pierre-yves.david@ens-lyon.org> wrote:
>>
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>>> # Date 1396031862 25200
>>> #      Fri Mar 28 11:37:42 2014 -0700
>>> # Node ID a403855f263738815a7fcc131a0588d742b5f273
>>> # Parent  1dc36565b5cc56e71f8e5a5ac5f97fdd85a4496d
>>> 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.
>>
>> This series looks good to me.
>>
>> I have a version where I fixed up some grammar, but I can't fb-crew it
>>due
>> to permissions issues.  Matt you can pull it from @ on my server if you
>> get to it before dsop fixes the permissions tomorrow.
>
>The permission should have been fixed now.


Queued for fb-crew.

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -325,23 +325,42 @@  class wirepeer(peer.peerrepository):
             opts['four'] = four
         return self._call('debugwireargs', one=one, two=two, **opts)
 
 # server side
 
+# wire protocol command can either return a string or one of this class.
 class streamres(object):
+    """wireproto reply: binary stream
+
+    The call was successful and the result is a stream.
+    Iterable to 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` attribut contains the error message.
+    """
     def __init__(self, res):
         self.res = res
 
 class ooberror(object):
+    """wireproto reply: failure of a batch of operation
+
+    During a batch call, something failed, the error message is stored in
+    `self.message`.
+    """
     def __init__(self, message):
         self.message = message
 
 def dispatch(repo, proto, command):
     repo = repo.filtered("served")