##// END OF EJS Templates
protocol: avoid sending outrageously large between requests
Matt Mackall -
r7342:1dcd2cc6 default
parent child Browse files
Show More
@@ -148,13 +148,16 b' class httprepository(repo.repository):'
148 raise util.UnexpectedOutput(_("unexpected response:"), d)
148 raise util.UnexpectedOutput(_("unexpected response:"), d)
149
149
150 def between(self, pairs):
150 def between(self, pairs):
151 n = " ".join(["-".join(map(hex, p)) for p in pairs])
151 batch = 8 # avoid giant requests
152 r = []
153 for i in xrange(0, len(pairs), batch):
154 n = " ".join(["-".join(map(hex, p)) for p in pairs[i:i + batch]])
152 d = self.do_read("between", pairs=n)
155 d = self.do_read("between", pairs=n)
153 try:
156 try:
154 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
157 r += [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
155 return p
156 except:
158 except:
157 raise util.UnexpectedOutput(_("unexpected response:"), d)
159 raise util.UnexpectedOutput(_("unexpected response:"), d)
160 return r
158
161
159 def changegroup(self, nodes, kind):
162 def changegroup(self, nodes, kind):
160 n = " ".join(map(hex, nodes))
163 n = " ".join(map(hex, nodes))
General Comments 0
You need to be logged in to leave comments. Login now