~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge_core.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
24
24
    merge_directive,
25
25
    osutils,
26
26
    )
27
 
from bzrlib.conflicts import (
28
 
    ContentsConflict,
29
 
    TextConflict,
30
 
    PathConflict,
31
 
    )
 
27
from bzrlib.conflicts import ContentsConflict, TextConflict, PathConflict
32
28
from bzrlib.merge import (
33
29
    Merge3Merger,
34
30
    Diff3Merger,
36
32
    Merger,
37
33
    )
38
34
from bzrlib.osutils import getcwd, pathjoin
 
35
from bzrlib import progress
39
36
from bzrlib.transform import TreeTransform
40
37
from bzrlib.tests import TestCaseWithTransport, TestSkipped
41
38
from bzrlib.workingtree import WorkingTree
493
490
        wtb = d_b.open_workingtree()
494
491
        wtb.commit('this revision', allow_pointless=False)
495
492
        self.assertEqual(1, wtb.merge_from_branch(wta.branch))
496
 
        self.assertPathExists('b/file.THIS')
497
 
        self.assertPathExists('b/file.BASE')
498
 
        self.assertPathExists('b/file.OTHER')
 
493
        self.failUnlessExists('b/file.THIS')
 
494
        self.failUnlessExists('b/file.BASE')
 
495
        self.failUnlessExists('b/file.OTHER')
499
496
        wtb.revert()
500
497
        self.assertEqual(1, wtb.merge_from_branch(wta.branch,
501
498
                                                  merge_type=WeaveMerger))
502
 
        self.assertPathExists('b/file')
503
 
        self.assertPathExists('b/file.THIS')
504
 
        self.assertPathExists('b/file.BASE')
505
 
        self.assertPathExists('b/file.OTHER')
 
499
        self.failUnlessExists('b/file')
 
500
        self.failUnlessExists('b/file.THIS')
 
501
        self.failUnlessExists('b/file.BASE')
 
502
        self.failUnlessExists('b/file.OTHER')
506
503
 
507
504
    def test_weave_conflicts_not_in_base(self):
508
505
        builder = self.make_branch_builder('source')
532
529
        self.assertEqual(1, tree.merge_from_branch(tree.branch,
533
530
                                                   to_revision='D-id',
534
531
                                                   merge_type=WeaveMerger))
535
 
        self.assertPathExists('tree/foo.THIS')
536
 
        self.assertPathExists('tree/foo.OTHER')
 
532
        self.failUnlessExists('tree/foo.THIS')
 
533
        self.failUnlessExists('tree/foo.OTHER')
537
534
        self.expectFailure('fail to create .BASE in some criss-cross merges',
538
 
            self.assertPathExists, 'tree/foo.BASE')
539
 
        self.assertPathExists('tree/foo.BASE')
 
535
            self.failUnlessExists, 'tree/foo.BASE')
 
536
        self.failUnlessExists('tree/foo.BASE')
540
537
 
541
538
    def test_merge_unrelated(self):
542
539
        """Sucessfully merges unrelated branches with no common names"""
584
581
        wtb.commit('changed file', allow_pointless=False)
585
582
        wtb.merge_from_branch(wta.branch, wta.branch.last_revision(),
586
583
                              wta.branch.get_rev_id(1))
587
 
        self.assertFalse(os.path.lexists('b/file'))
 
584
        self.failIf(os.path.lexists('b/file'))
588
585
 
589
586
    def test_merge_metadata_vs_deletion(self):
590
587
        """Conflict deletion vs metadata change"""
618
615
        b_wt.commit('r1', rev_id='r1')
619
616
        self.assertEqual(0, a_wt.merge_from_branch(b_wt.branch,
620
617
            b_wt.branch.last_revision(), b_wt.branch.get_rev_id(1)))
621
 
        self.assertPathExists('a/un')
622
 
        self.assertTrue('a/deux')
 
618
        self.failUnlessExists('a/un')
 
619
        self.failUnless('a/deux')
623
620
        self.assertFalse(os.path.exists('a/tmp'))
624
621
        self.assertEqual(file('a/un').read(),'DEUX')
625
622
        self.assertEqual(file('a/deux').read(),'UN')