# HG changeset patch # User Matt Mackall # Date 1281043059 18000 # Node ID 65bd4b8e48bdf5422f4da13201936934cc14d49e # Parent 0299240b849b4689bd7a406c564e8914cc7cdd05 httprepo: decompress stream incrementally to reduce memory usage diff -r 0299240b849b -r 65bd4b8e48bd mercurial/httprepo.py --- 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()