Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/wireproto.py Wed Jul 14 16:34:57 2010 -0500 +++ b/mercurial/wireproto.py Wed Jul 14 16:35:51 2010 -0500 @@ -59,13 +59,17 @@ self._abort(error.ResponseError(_("unexpected response:"), d)) def between(self, pairs): - n = " ".join(["-".join(map(hex, p)) for p in pairs]) - d = self._call("between", pairs=n) - try: - p = [l and map(bin, l.split(" ")) or [] for l in d.splitlines()] - return p - except: - self._abort(error.ResponseError(_("unexpected response:"), d)) + batch = 8 # avoid giant requests + r = [] + for i in xrange(0, len(pairs), batch): + n = " ".join(["-".join(map(hex, p)) for p in pairs[i:i + batch]]) + d = self._call("between", pairs=n) + try: + r += [l and map(bin, l.split(" ")) or [] + for l in d.splitlines()] + except: + self._abort(error.ResponseError(_("unexpected response:"), d)) + return r def pushkey(self, namespace, key, old, new): if not self.capable('pushkey'):