~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-23 00:58:30 UTC
  • mfrom: (4300.2.1 1.15-gc-python)
  • mto: This revision was merged to the branch mainline in revision 4301.
  • Revision ID: john@arbash-meinel.com-20090423005830-kkdc31tqjetbj2f0
Bring in the other test cases.
Also, remove the assert statements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    def _flush_insert(self):
46
46
        if not self.cur_insert_lines:
47
47
            return
48
 
        assert self.cur_insert_len <= 127
 
48
        if self.cur_insert_len > 127:
 
49
            raise AssertionError('We cannot insert more than 127 bytes'
 
50
                                 ' at a time.')
49
51
        self.out_lines.append(chr(self.cur_insert_len))
50
52
        self.index_lines.append(False)
51
53
        self.out_lines.extend(self.cur_insert_lines)
70
72
            self.index_lines.append(False)
71
73
 
72
74
    def add_insert(self, lines):
73
 
        assert self.cur_insert_lines == []
74
 
        assert self.cur_insert_len == 0
 
75
        if self.cur_insert_lines != []:
 
76
            raise AssertionError('self.cur_insert_lines must be empty when'
 
77
                                 ' adding a new insert')
75
78
        for line in lines:
76
79
            if len(line) > 127:
77
80
                self._insert_long_line(line)
313
316
            copy_bytes.append(chr(base_byte))
314
317
        offset >>= 8
315
318
    if length is None:
316
 
        # None is used by the test suite
317
 
        copy_bytes[0] = chr(copy_command)
318
 
        return ''.join(copy_bytes)
 
319
        raise ValueError("cannot supply a length of None")
319
320
    if length > 0x10000:
320
321
        raise ValueError("we don't emit copy records for lengths > 64KiB")
321
322
    if length == 0: