~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_groupcompress_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-04-21 23:54:16 UTC
  • mto: (4300.1.7 groupcompress_info)
  • mto: This revision was merged to the branch mainline in revision 4301.
  • Revision ID: john@arbash-meinel.com-20090421235416-f0cz6ilf5cufbugi
Fix bug #364900, properly remove the 64kB that was just encoded in the copy.
Also, stop supporting None as a copy length in 'encode_copy_instruction'.
It was only used by the test suite, and it is good to pull that sort of thing out of
production code. (Besides, setting the copy to 64kB has the same effect.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
        # The data stream allows >64kB in a copy, but to match the compiled
206
206
        # code, we will also limit it to a 64kB copy
207
207
        for start_byte in xrange(first_byte, stop_byte, 64*1024):
208
 
            num_bytes = min(64*1024, stop_byte - first_byte)
 
208
            num_bytes = min(64*1024, stop_byte - start_byte)
209
209
            copy_bytes = encode_copy_instruction(start_byte, num_bytes)
210
210
            out_lines.append(copy_bytes)
211
211
            index_lines.append(False)
271
271
            copy_bytes.append(chr(base_byte))
272
272
        offset >>= 8
273
273
    if length is None:
274
 
        # None is used by the test suite
275
 
        copy_bytes[0] = chr(copy_command)
276
 
        return ''.join(copy_bytes)
 
274
        raise ValueError("cannot supply a length of None")
277
275
    if length > 0x10000:
278
276
        raise ValueError("we don't emit copy records for lengths > 64KiB")
279
277
    if length == 0: