/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/_groupcompress_py.py

  • Committer: Jelmer Vernooij
  • Date: 2009-05-01 14:29:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4321.
  • Revision ID: jelmer@samba.org-20090501142906-7zj8hcpp9igzuyi4
Add repository argument to 'repository' info hook, per Roberts review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
                ' got out of sync with the line counter.')
249
249
        self.endpoint = endpoint
250
250
 
251
 
    def _flush_insert(self, start_linenum, end_linenum,
252
 
                      new_lines, out_lines, index_lines):
253
 
        """Add an 'insert' request to the data stream."""
254
 
        bytes_to_insert = ''.join(new_lines[start_linenum:end_linenum])
255
 
        insert_length = len(bytes_to_insert)
256
 
        # Each insert instruction is at most 127 bytes long
257
 
        for start_byte in xrange(0, insert_length, 127):
258
 
            insert_count = min(insert_length - start_byte, 127)
259
 
            out_lines.append(chr(insert_count))
260
 
            # Don't index the 'insert' instruction
261
 
            index_lines.append(False)
262
 
            insert = bytes_to_insert[start_byte:start_byte+insert_count]
263
 
            as_lines = osutils.split_lines(insert)
264
 
            out_lines.extend(as_lines)
265
 
            index_lines.extend([True]*len(as_lines))
266
 
 
267
 
    def _flush_copy(self, old_start_linenum, num_lines,
268
 
                    out_lines, index_lines):
269
 
        if old_start_linenum == 0:
270
 
            first_byte = 0
271
 
        else:
272
 
            first_byte = self.line_offsets[old_start_linenum - 1]
273
 
        stop_byte = self.line_offsets[old_start_linenum + num_lines - 1]
274
 
        num_bytes = stop_byte - first_byte
275
 
        # The data stream allows >64kB in a copy, but to match the compiled
276
 
        # code, we will also limit it to a 64kB copy
277
 
        for start_byte in xrange(first_byte, stop_byte, 64*1024):
278
 
            num_bytes = min(64*1024, stop_byte - start_byte)
279
 
            copy_bytes = encode_copy_instruction(start_byte, num_bytes)
280
 
            out_lines.append(copy_bytes)
281
 
            index_lines.append(False)
282
 
 
283
251
    def make_delta(self, new_lines, bytes_length=None, soft=False):
284
252
        """Compute the delta for this content versus the original content."""
285
253
        if bytes_length is None: