~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/chunk_writer.py

  • Committer: John Arbash Meinel
  • Date: 2008-08-25 16:24:09 UTC
  • mto: This revision was merged to the branch mainline in revision 3688.
  • Revision ID: john@arbash-meinel.com-20080825162409-0766y19zjs45m87i
Do a bit more work to get all the tests to pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        This returns the final compressed chunk, and either None, or the
94
94
        bytes that did not fit in the chunk.
95
95
        """
 
96
        # self.bytes_list = self.bytes_in
 
97
        # bytes_out_len = sum(map(len, self.bytes_list))
 
98
        # if bytes_out_len > self.chunk_size:
 
99
        #     raise Assertion("too much data: %d" % bytes_out_len)
 
100
        # self.bytes_in = None
 
101
        # nulls_needed = self.chunk_size - self.seen_bytes
 
102
        # if nulls_needed:
 
103
        #     self.bytes_list.append("\x00" * nulls_needed)
 
104
        # return self.bytes_list, self.unused_bytes, nulls_needed
 
105
 
96
106
        self.bytes_in = None # Free the data cached so far, we don't need it
97
107
        out = self.compressor.flush(Z_FINISH)
98
108
        self.bytes_list.append(out)
101
111
            raise AssertionError('Somehow we ended up with too much'
102
112
                                 ' compressed data, %d > %d'
103
113
                                 % (self.bytes_out_len, self.chunk_size))
104
 
        nulls_needed = self.chunk_size - self.bytes_out_len % self.chunk_size
 
114
        nulls_needed = self.chunk_size - self.bytes_out_len
105
115
        if nulls_needed:
106
116
            self.bytes_list.append("\x00" * nulls_needed)
107
117
        return self.bytes_list, self.unused_bytes, nulls_needed