##// END OF EJS Templates
largefiles: drop limitreader, use filechunkiter limit...
Mads Kiilerich -
r19005:1b84047e default
parent child Browse files
Show More
@@ -309,21 +309,6 b' def hashfile(file):'
309 fd.close()
309 fd.close()
310 return hasher.hexdigest()
310 return hasher.hexdigest()
311
311
312 class limitreader(object):
313 def __init__(self, f, limit):
314 self.f = f
315 self.limit = limit
316
317 def read(self, length):
318 if self.limit == 0:
319 return ''
320 length = length > self.limit and self.limit or length
321 self.limit -= length
322 return self.f.read(length)
323
324 def close(self):
325 pass
326
327 def writehash(hash, filename, executable):
312 def writehash(hash, filename, executable):
328 util.makedirs(os.path.dirname(filename))
313 util.makedirs(os.path.dirname(filename))
329 util.writefile(filename, hash + '\n')
314 util.writefile(filename, hash + '\n')
@@ -123,11 +123,9 b' def wirereposetup(ui, repo):'
123 self._abort(error.ResponseError(_("unexpected response:"),
123 self._abort(error.ResponseError(_("unexpected response:"),
124 length))
124 length))
125
125
126 # Mercurial doesn't close SSH connections after writing a stream
126 # SSH streams will block if reading more than length
127 infile = lfutil.limitreader(stream, length)
127 for chunk in util.filechunkiter(stream, 128 * 1024, length):
128 for chunk in util.filechunkiter(infile, 128 * 1024):
129 yield chunk
128 yield chunk
130 infile.close()
131
129
132 @batchable
130 @batchable
133 def statlfile(self, sha):
131 def statlfile(self, sha):
General Comments 0
You need to be logged in to leave comments. Login now