~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tuned_gzip.py

  • Committer: Martin Pool
  • Date: 2007-10-12 08:00:07 UTC
  • mto: This revision was merged to the branch mainline in revision 2913.
  • Revision ID: mbp@sourcefrog.net-20071012080007-vf80woayyom8s8e1
Rename update_to_one_parent_via_delta to more wieldy update_basis_by_delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
 
150
150
        if buf == "":
151
151
            self._add_read_data(self.decompress.flush())
152
 
            if len(self.decompress.unused_data) < 8:
153
 
                raise AssertionError("what does flush do?")
 
152
            assert len(self.decompress.unused_data) >= 8, "what does flush do?"
154
153
            self._gzip_tail = self.decompress.unused_data[0:8]
155
154
            self._read_eof()
156
155
            # tell the driving read() call we have stuffed all the data
176
175
                self._gzip_tail = self.decompress.unused_data[0:8]
177
176
            elif seek_length < 0:
178
177
                # we haven't read enough to check the checksum.
179
 
                if not (-8 < seek_length):
180
 
                    raise AssertionError("too great a seek")
 
178
                assert -8 < seek_length, "too great a seek."
181
179
                buf = self.fileobj.read(-seek_length)
182
180
                self._gzip_tail = self.decompress.unused_data + buf
183
181
            else:
202
200
        # We then check the that the computed CRC and size of the
203
201
        # uncompressed data matches the stored values.  Note that the size
204
202
        # stored is the true file size mod 2**32.
205
 
        if not (len(self._gzip_tail) == 8):
206
 
            raise AssertionError("gzip trailer is incorrect length.")
 
203
        assert len(self._gzip_tail) == 8, "gzip trailer is incorrect length."
207
204
        crc32, isize = struct.unpack("<LL", self._gzip_tail)
208
205
        # note that isize is unsigned - it can exceed 2GB
209
206
        if crc32 != U32(self.crc):