~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-23 19:25:01 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090623192501-qzf1a07g8gxzkrxl
Add tests tha left-matching-blocks gets populated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3399
3399
                # The cached build_details are no longer valid
3400
3400
                self._all_build_details.clear()
3401
3401
 
 
3402
    def _cache_delta_blocks(self, key, compression_parent, delta, lines):
 
3403
        parent_lines = self._text_cache[compression_parent]
 
3404
        blocks = list(KnitContent.get_line_delta_blocks(delta, parent_lines, lines))
 
3405
        self._left_matching_blocks[key] = blocks
 
3406
 
3402
3407
    def _expand_record(self, key, parent_keys, compression_parent, record,
3403
3408
                       record_details):
 
3409
        delta = None
3404
3410
        if compression_parent:
3405
3411
            if compression_parent not in self._content_objects:
3406
3412
                # Waiting for the parent
3422
3428
            # gives very bad results.
3423
3429
            # The alternative is to copy the lines into text cache, but then we
3424
3430
            # are copying anyway, so just do it here.
3425
 
            content, _ = self._vf._factory.parse_record(
 
3431
            content, delta = self._vf._factory.parse_record(
3426
3432
                key, record, record_details, base_content,
3427
3433
                copy_base_content=True)
3428
3434
        else:
3429
3435
            # Fulltext record
3430
3436
            content, _ = self._vf._factory.parse_record(
3431
3437
                key, record, record_details, None)
3432
 
        # TODO: Only track the content when there are compression children.
3433
 
        #       Otherwise we only need the lines
3434
3438
        if self._num_compression_children.get(key, 0) > 0:
3435
3439
            self._content_objects[key] = content
3436
3440
        lines = content.text()
3437
3441
        self._text_cache[key] = lines
 
3442
        if delta is not None:
 
3443
            self._cache_delta_blocks(key, compression_parent, delta, lines)
3438
3444
        return lines
3439
3445
 
3440
3446
    def _process_pending(self, key):