##// END OF EJS Templates
remove duplicate zgenerator in httprepo
Matt Mackall -
r3661:e99ba872 default
parent child Browse files
Show More
@@ -114,6 +114,15 b' else:'
114 class httphandler(basehttphandler):
114 class httphandler(basehttphandler):
115 pass
115 pass
116
116
117 def zgenerator(f):
118 zd = zlib.decompressobj()
119 try:
120 for chunk in util.filechunkiter(f):
121 yield zd.decompress(chunk)
122 except httplib.HTTPException, inst:
123 raise IOError(None, _('connection ended unexpectedly'))
124 yield zd.flush()
125
117 class httprepository(remoterepository):
126 class httprepository(remoterepository):
118 def __init__(self, ui, path):
127 def __init__(self, ui, path):
119 self.path = path
128 self.path = path
@@ -305,33 +314,13 b' class httprepository(remoterepository):'
305 def changegroup(self, nodes, kind):
314 def changegroup(self, nodes, kind):
306 n = " ".join(map(hex, nodes))
315 n = " ".join(map(hex, nodes))
307 f = self.do_cmd("changegroup", roots=n)
316 f = self.do_cmd("changegroup", roots=n)
308
317 return util.chunkbuffer(zgenerator(f))
309 def zgenerator(f):
310 zd = zlib.decompressobj()
311 try:
312 for chnk in f:
313 yield zd.decompress(chnk)
314 except httplib.HTTPException, inst:
315 raise IOError(None, _('connection ended unexpectedly'))
316 yield zd.flush()
317
318 return util.chunkbuffer(zgenerator(util.filechunkiter(f)))
319
318
320 def changegroupsubset(self, bases, heads, source):
319 def changegroupsubset(self, bases, heads, source):
321 baselst = " ".join([hex(n) for n in bases])
320 baselst = " ".join([hex(n) for n in bases])
322 headlst = " ".join([hex(n) for n in heads])
321 headlst = " ".join([hex(n) for n in heads])
323 f = self.do_cmd("changegroupsubset", bases=baselst, heads=headlst)
322 f = self.do_cmd("changegroupsubset", bases=baselst, heads=headlst)
324
323 return util.chunkbuffer(zgenerator(f))
325 def zgenerator(f):
326 zd = zlib.decompressobj()
327 try:
328 for chnk in f:
329 yield zd.decompress(chnk)
330 except httplib.HTTPException:
331 raise IOError(None, _('connection ended unexpectedly'))
332 yield zd.flush()
333
334 return util.chunkbuffer(zgenerator(util.filechunkiter(f)))
335
324
336 def unbundle(self, cg, heads, source):
325 def unbundle(self, cg, heads, source):
337 # have to stream bundle to a temp file because we do not have
326 # have to stream bundle to a temp file because we do not have
General Comments 0
You need to be logged in to leave comments. Login now