comparison mercurial/wireproto.py @ 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 982f13bef503
children 8d477543882b
comparison
equal deleted inserted replaced
20901:a26dfa7f534c 20902:1e4fda2f5cf1
325 opts['four'] = four 325 opts['four'] = four
326 return self._call('debugwireargs', one=one, two=two, **opts) 326 return self._call('debugwireargs', one=one, two=two, **opts)
327 327
328 # server side 328 # server side
329 329
330 # wire protocol command can either return a string or one of these classes.
330 class streamres(object): 331 class streamres(object):
332 """wireproto reply: binary stream
333
334 The call was successful and the result is a stream.
335 Iterate on the `self.gen` attribute to retrieve chunks.
336 """
331 def __init__(self, gen): 337 def __init__(self, gen):
332 self.gen = gen 338 self.gen = gen
333 339
334 class pushres(object): 340 class pushres(object):
341 """wireproto reply: success with simple integer return
342
343 The call was successful and returned an integer contained in `self.res`.
344 """
335 def __init__(self, res): 345 def __init__(self, res):
336 self.res = res 346 self.res = res
337 347
338 class pusherr(object): 348 class pusherr(object):
349 """wireproto reply: failure
350
351 The call failed. The `self.res` attribute contains the error message.
352 """
339 def __init__(self, res): 353 def __init__(self, res):
340 self.res = res 354 self.res = res
341 355
342 class ooberror(object): 356 class ooberror(object):
357 """wireproto reply: failure of a batch of operation
358
359 Something failed during a batch call. The error message is stored in
360 `self.message`.
361 """
343 def __init__(self, message): 362 def __init__(self, message):
344 self.message = message 363 self.message = message
345 364
346 def dispatch(repo, proto, command): 365 def dispatch(repo, proto, command):
347 repo = repo.filtered("served") 366 repo = repo.filtered("served")