~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Aaron Bentley
  • Date: 2007-12-03 15:15:36 UTC
  • mto: This revision was merged to the branch mainline in revision 3133.
  • Revision ID: abentley@panoramicfeedback.com-20071203151536-b34fe60wl3nr9eln
Add support for plan-merge with a base

Show diffs side-by-side

added added

removed removed

Lines of Context:
368
368
                          ('killed-a', 'b\n'),
369
369
                          ('unchanged', 'g\n')],
370
370
                         list(plan))
 
371
 
 
372
    def test_subtract_plans(self):
 
373
        old_plan = [
 
374
        ('unchanged', 'a\n'),
 
375
        ('new-a', 'b\n'),
 
376
        ('killed-a', 'c\n'),
 
377
        ('new-b', 'd\n'),
 
378
        ('new-b', 'e\n'),
 
379
        ('killed-b', 'f\n'),
 
380
        ('killed-b', 'g\n'),
 
381
        ]
 
382
        new_plan = [
 
383
        ('unchanged', 'a\n'),
 
384
        ('new-a', 'b\n'),
 
385
        ('killed-a', 'c\n'),
 
386
        ('new-b', 'd\n'),
 
387
        ('new-b', 'h\n'),
 
388
        ('killed-b', 'f\n'),
 
389
        ('killed-b', 'i\n'),
 
390
        ]
 
391
        subtracted_plan = [
 
392
        ('unchanged', 'a\n'),
 
393
        ('new-a', 'b\n'),
 
394
        ('killed-a', 'c\n'),
 
395
        ('new-b', 'h\n'),
 
396
        ('unchanged', 'f\n'),
 
397
        ('killed-b', 'i\n'),
 
398
        ]
 
399
        self.assertEqual(subtracted_plan,
 
400
            list(PlanMerge._subtract_plans(old_plan, new_plan)))
 
401
 
 
402
    def test_plan_merge_with_base(self):
 
403
        self.add_version('COMMON', [], 'abc')
 
404
        self.add_version('THIS', ['COMMON'], 'abcd')
 
405
        self.add_version('BASE', ['COMMON'], 'eabc')
 
406
        self.add_version('OTHER', ['BASE'], 'eafb')
 
407
        plan = PlanMerge.plan_merge_with_base('THIS', 'BASE', 'OTHER',
 
408
                                              self.plan_merge_vf)
 
409
        self.assertEqual([('unchanged', 'a\n'),
 
410
                          ('new-b', 'f\n'),
 
411
                          ('unchanged', 'b\n'),
 
412
                          ('killed-b', 'c\n'),
 
413
                          ('new-a', 'd\n')
 
414
                         ], list(plan))