~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to groupcompress.py

Only decompress as much of the zlib data as is needed to read the text recipe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
297
297
 
298
298
 
299
299
def cleanup_pack_group(versioned_files):
 
300
    versioned_files.writer.end()
300
301
    versioned_files.stream.close()
301
 
    versioned_files.writer.end()
302
302
 
303
303
 
304
304
class GroupCompressVersionedFiles(VersionedFiles):
487
487
                parents = self._unadded_refs[key]
488
488
            else:
489
489
                index_memo, _, parents, (method, _) = locations[key]
490
 
                # read
 
490
                # read the group
491
491
                read_memo = index_memo[0:3]
492
492
                zdata = self._access.get_raw_records([read_memo]).next()
493
 
                # decompress
494
 
                plain = zlib.decompress(zdata)
495
 
                # parse
 
493
                # decompress - whole thing; this is a bug.
 
494
                decomp = zlib.decompressobj()
 
495
                plain = decomp.decompress(zdata, index_memo[4])
 
496
                # cheapo debugging:
 
497
                # print len(zdata), len(plain)
 
498
                # parse - requires split_lines, better to have byte offsets here.
496
499
                delta_lines = split_lines(plain[index_memo[3]:index_memo[4]])
497
500
                label, sha1, delta = parse(delta_lines)
498
501
                if label != key: