Mercurial > hg
comparison mercurial/wireproto.py @ 11587:a036f6bd1da3
protocol: unify basic http client requests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 14 Jul 2010 16:35:51 -0500 |
parents | ddaaaa23bb8f |
children | 8a1f625e971d |
comparison
equal
deleted
inserted
replaced
11586:ddaaaa23bb8f | 11587:a036f6bd1da3 |
---|---|
57 return br | 57 return br |
58 except: | 58 except: |
59 self._abort(error.ResponseError(_("unexpected response:"), d)) | 59 self._abort(error.ResponseError(_("unexpected response:"), d)) |
60 | 60 |
61 def between(self, pairs): | 61 def between(self, pairs): |
62 n = " ".join(["-".join(map(hex, p)) for p in pairs]) | 62 batch = 8 # avoid giant requests |
63 d = self._call("between", pairs=n) | 63 r = [] |
64 try: | 64 for i in xrange(0, len(pairs), batch): |
65 p = [l and map(bin, l.split(" ")) or [] for l in d.splitlines()] | 65 n = " ".join(["-".join(map(hex, p)) for p in pairs[i:i + batch]]) |
66 return p | 66 d = self._call("between", pairs=n) |
67 except: | 67 try: |
68 self._abort(error.ResponseError(_("unexpected response:"), d)) | 68 r += [l and map(bin, l.split(" ")) or [] |
69 for l in d.splitlines()] | |
70 except: | |
71 self._abort(error.ResponseError(_("unexpected response:"), d)) | |
72 return r | |
69 | 73 |
70 def pushkey(self, namespace, key, old, new): | 74 def pushkey(self, namespace, key, old, new): |
71 if not self.capable('pushkey'): | 75 if not self.capable('pushkey'): |
72 return False | 76 return False |
73 d = self._call("pushkey", | 77 d = self._call("pushkey", |