Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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))
Пример #4
0
 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
Пример #6
0
 def greet(self, name):
     f = wireproto.future()
     yield wireproto.todict(name=mangle(name)), f
     yield unmangle(f.value)
Пример #7
0
 def greet(self, name):
     f = wireproto.future()
     yield {'name': mangle(name)}, f
     yield unmangle(f.value)
Пример #8
0
 def bar(self, b, a):
     encresref = future()
     yield [('b', mangle(b),), ('a', mangle(a),)], encresref
     yield unmangle(encresref.value)