def foo(self, one, two=None): if not one: yield "Nope", None encargs = [('one', mangle(one),), ('two', mangle(two),)] encresref = future() yield encargs, encresref yield unmangle(encresref.value)
def getannotate(self, path, lastnode=None): if not self.capable('getannotate'): ui.warn(_('remote peer cannot provide annotate cache\n')) yield None, None else: args = {'path': path, 'lastnode': lastnode or ''} f = wireproto.future() yield args, f yield _parseresponse(f.value)
def heads(self): f = wireproto.future() yield {}, f d = f.value if d[:len(_heads_prefix)] == _heads_prefix: d = d[len(_heads_prefix):] try: yield wireproto.decodelist(d[:-1]) except ValueError: self._abort(error.ResponseError(_("unexpected response:"), d))
def statlfile(self, sha): f = wireproto.future() result = {'sha': sha} yield result, f try: yield int(f.value) except (ValueError, urllib2.HTTPError): # If the server returns anything but an integer followed by a # newline, newline, it's not speaking our language; if we get # an HTTP error, we can't be sure the largefile is present; # either way, consider it missing. yield 2
def statlfile(self, sha): f = wireproto.future() result = {'sha': sha} yield result, f try: yield int(f.value) except (ValueError, urlerr.httperror): # If the server returns anything but an integer followed by a # newline, newline, it's not speaking our language; if we get # an HTTP error, we can't be sure the largefile is present; # either way, consider it missing. yield 2
def greet(self, name): f = wireproto.future() yield wireproto.todict(name=mangle(name)), f yield unmangle(f.value)
def greet(self, name): f = wireproto.future() yield {'name': mangle(name)}, f yield unmangle(f.value)
def bar(self, b, a): encresref = future() yield [('b', mangle(b),), ('a', mangle(a),)], encresref yield unmangle(encresref.value)