Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httprepo.py @ 11757:65bd4b8e48bd stable
httprepo: decompress stream incrementally to reduce memory usage
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 05 Aug 2010 16:17:39 -0500 |
parents | db3f6f0e4e7d |
children | 05deba16c5d5 |
line wrap: on
line diff
--- a/mercurial/httprepo.py Thu Aug 05 16:17:33 2010 -0500 +++ b/mercurial/httprepo.py Thu Aug 05 16:17:39 2010 -0500 @@ -17,7 +17,9 @@ zd = zlib.decompressobj() try: for chunk in util.filechunkiter(f): - yield zd.decompress(chunk) + while chunk: + yield zd.decompress(chunk, 2**18) + chunk = zd.unconsumed_tail except httplib.HTTPException: raise IOError(None, _('connection ended unexpectedly')) yield zd.flush()