mercurial/wireproto.py
changeset 11587 a036f6bd1da3
parent 11586 ddaaaa23bb8f
child 11588 8a1f625e971d
--- 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'):