~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tuned_gzip.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-15 21:00:20 UTC
  • mfrom: (3113.5.1 test.174055)
  • Revision ID: pqm@pqm.ubuntu.com-20071215210020-m28kk1qmbcc9n6qs
(bialix) XFAIL test for #174055: can't run bzr info while dirstate
 is locked

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):