~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
from bzrlib.tsort import topo_sort
91
91
import bzrlib.weave
92
92
from bzrlib.versionedfile import VersionedFile, InterVersionedFile
 
93
import bzrlib.patiencediff
93
94
 
94
95
 
95
96
# TODO: Split out code specific to this format into an associated object.
522
523
            delta_seq = None
523
524
            for parent_id in parents:
524
525
                merge_content = self._get_content(parent_id, parent_texts)
525
 
                seq = KnitSequenceMatcher(None, merge_content.text(), content.text())
 
526
                seq = bzrlib.patiencediff.PatienceSequenceMatcher(
 
527
                                   None, merge_content.text(), content.text())
526
528
                if delta_seq is None:
527
529
                    # setup a delta seq to reuse.
528
530
                    delta_seq = seq
539
541
                reference_content = self._get_content(parents[0], parent_texts)
540
542
                new_texts = content.text()
541
543
                old_texts = reference_content.text()
542
 
                delta_seq = KnitSequenceMatcher(None, old_texts, new_texts)
 
544
                delta_seq = bzrlib.patiencediff.PatienceSequenceMatcher(
 
545
                                                 None, old_texts, new_texts)
543
546
            return self._make_line_delta(delta_seq, content)
544
547
 
545
548
    def _make_line_delta(self, delta_seq, new_content):