~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-11 21:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080711214124-qi09irlj7pd5cuzg
Shortcut the case when one revision is in the ancestry of the other.

At the cost of a heads() check, when one parent supersedes, we don't have to extract
the text for the other. Changes merge time from 3m37s => 3m21s. Using a
CachingParentsProvider would drop the time down to 3m11s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
525
525
        self.add_version(('root', 'D'),
526
526
            [('root', 'A'), ('root', 'B'), ('root', 'C')], 'abcdegh')
527
527
        my_plan = _PlanMerge('B', 'D', self.plan_merge_vf, ('root',))
 
528
        # We shortcut when one text supersedes the other in the per-file graph.
 
529
        # We don't actually need to compare the texts at this point.
528
530
        self.assertEqual([
529
 
                          ('unchanged', 'a\n'),
530
 
                          ('unchanged', 'b\n'),
531
 
                          ('unchanged', 'c\n'),
532
 
                          ('unchanged', 'd\n'),
533
 
                          ('unchanged', 'e\n'),
 
531
                          ('new-b', 'a\n'),
 
532
                          ('new-b', 'b\n'),
 
533
                          ('new-b', 'c\n'),
 
534
                          ('new-b', 'd\n'),
 
535
                          ('new-b', 'e\n'),
534
536
                          ('new-b', 'g\n'),
535
537
                          ('new-b', 'h\n')],
536
538
                          list(my_plan.plan_merge()))