~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Robey Pointer
  • Date: 2006-09-03 00:28:18 UTC
  • mfrom: (1981 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060903002818-71ca5c7bfea93a26
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
    def test_pending(self):
36
36
        wt = self.make_branch_and_tree('.')
37
 
        wt.commit("lala!")
38
 
        self.assertEquals(len(wt.pending_merges()), 0)
 
37
        rev_a = wt.commit("lala!")
 
38
        self.assertEqual([rev_a], wt.get_parent_ids())
39
39
        merge([u'.', -1], [None, None])
40
 
        self.assertEquals(len(wt.pending_merges()), 0)
 
40
        self.assertEqual([rev_a], wt.get_parent_ids())
41
41
 
42
42
    def test_undo(self):
43
43
        wt = self.make_branch_and_tree('.')
60
60
                          [None, None])
61
61
        return wt2
62
62
 
63
 
    def test_merge_one(self):
 
63
    def test_merge_one_file(self):
 
64
        """Do a partial merge of a tree which should not affect tree parents."""
64
65
        wt1 = self.make_branch_and_tree('branch1')
65
 
        wt1.commit('empty commit')
 
66
        tip = wt1.commit('empty commit')
66
67
        wt2 = self.make_branch_and_tree('branch2')
67
68
        wt2.pull(wt1.branch)
68
69
        file('branch1/foo', 'wb').write('foo')
75
76
        self.run_bzr('merge', '../branch1/foo')
76
77
        self.failUnlessExists('foo')
77
78
        self.failIfExists('bar')
78
 
        wt2 = WorkingTree.open_containing('branch2')[0]
79
 
        self.assertEqual(wt2.pending_merges(), [])
80
 
 
 
79
        wt2 = WorkingTree.open('.') # opens branch2
 
80
        self.assertEqual([tip], wt2.get_parent_ids())
 
81
        
81
82
    def test_pending_with_null(self):
82
83
        """When base is forced to revno 0, pending_merges is set"""
83
84
        wt2 = self.test_unrelated()
86
87
        br1.fetch(wt2.branch)
87
88
        # merge all of branch 2 into branch 1 even though they 
88
89
        # are not related.
89
 
        self.assertRaises(BzrCommandError, merge, ['branch2', -1], 
 
90
        self.assertRaises(BzrCommandError, merge, ['branch2', -1],
90
91
                          ['branch2', 0], reprocess=True, show_base=True)
91
92
        merge(['branch2', -1], ['branch2', 0], reprocess=True)
92
 
        self.assertEquals(len(wt1.pending_merges()), 1)
 
93
        self.assertEqual([br1.last_revision(), wt2.branch.last_revision()],
 
94
            wt1.get_parent_ids())
93
95
        return (wt1, wt2.branch)
94
96
 
95
97
    def test_two_roots(self):
97
99
        wt1, br2 = self.test_pending_with_null()
98
100
        wt1.commit("blah")
99
101
        last = wt1.branch.last_revision()
100
 
        self.assertEquals(common_ancestor(last, last, wt1.branch.repository), last)
 
102
        self.assertEqual(common_ancestor(last, last, wt1.branch.repository), last)
101
103
 
102
104
    def test_create_rename(self):
103
105
        """Rename an inventory entry while creating the file"""