--- a/mercurial/util.py Thu Oct 11 00:46:47 2007 -0500
+++ b/mercurial/util.py Thu Oct 11 00:46:48 2007 -0500
@@ -1396,27 +1396,14 @@
"""Allow arbitrary sized chunks of data to be efficiently read from an
iterator over chunks of arbitrary size."""
- def __init__(self, in_iter, targetsize = 2**16):
+ def __init__(self, in_iter):
"""in_iter is the iterator that's iterating over the input chunks.
targetsize is how big a buffer to try to maintain."""
self.in_iter = iter(in_iter)
self.buf = ''
- self.targetsize = int(targetsize)
- if self.targetsize <= 0:
- raise ValueError(_("targetsize must be greater than 0, was %d") %
- targetsize)
+ self.targetsize = 2**16
self.iterempty = False
- def fillbuf(self):
- """Ignore target size; read every chunk from iterator until empty."""
- if not self.iterempty:
- collector = cStringIO.StringIO()
- collector.write(self.buf)
- for ch in self.in_iter:
- collector.write(ch)
- self.buf = collector.getvalue()
- self.iterempty = True
-
def read(self, l):
"""Read L bytes of data from the iterator of chunks of data.
Returns less than L bytes if the iterator runs dry."""