Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 1199:78ceaf83f28f
Created a class in util called chunkbuffer that buffers reads from an
iterator over strings (aka chunks).
Also added to util (for future use) is a generator function that
iterates over a file n bytes at a time.
Lastly, localrepo was changed to use this new chunkbuffer class when
reading changegroups form the local repository.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Sun, 04 Sep 2005 14:11:51 -0700 |
parents | 899b619a7eb2 |
children | 5381b0d88e9e |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Sep 03 23:52:39 2005 -0700 +++ b/mercurial/localrepo.py Sun Sep 04 14:11:51 2005 -0700 @@ -888,21 +888,7 @@ return remote.addchangegroup(cg) def changegroup(self, basenodes): - class genread: - def __init__(self, generator): - self.g = generator - self.buf = "" - def fillbuf(self): - self.buf += "".join(self.g) - - def read(self, l): - while l > len(self.buf): - try: - self.buf += self.g.next() - except StopIteration: - break - d, self.buf = self.buf[:l], self.buf[l:] - return d + genread = util.chunkbuffer def gengroup(): nodes = self.newer(basenodes)