~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to groupcompress.py

Get the tests passing again
Also fix the Compressor.extract() for the new changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
        header_length = int(bytes[pos:pos2])
166
166
        if z_header_length == 0:
167
167
            assert header_length == 0
168
 
            out._content = zlib.decompress(bytes[pos2+1:])
169
 
            out._size = len(out._content)
 
168
            zcontent = bytes[pos2+1:]
 
169
            if zcontent:
 
170
                out._content = zlib.decompress(zcontent)
 
171
                out._size = len(out._content)
170
172
            return out
171
173
        pos = pos2 + 1
172
174
        pos2 = pos + z_header_length
409
411
        # TODO: Fix this, we shouldn't really be peeking here
410
412
        entry = self._block._entries[key]
411
413
        if entry.type == 'fulltext':
412
 
            bytes = stored_bytes
 
414
            assert stored_bytes[0] == 'f'
 
415
            bytes = stored_bytes[1:]
413
416
        else:
414
417
            assert entry.type == 'delta'
415
418
            # XXX: This is inefficient at best
416
419
            source = ''.join(self.lines)
417
 
            bytes = _groupcompress_pyx.apply_delta(source, stored_bytes)
 
420
            assert stored_bytes[0] == 'd'
 
421
            bytes = _groupcompress_pyx.apply_delta(source, stored_bytes[1:])
418
422
            assert entry.sha1 == sha_string(bytes)
419
423
        return bytes, entry.sha1
420
424