~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-28 07:08:27 UTC
  • mfrom: (2553.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070628070827-h5s313dg5tnag9vj
(robertc) Show the names of commit hooks during commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    option,
24
24
    )
25
25
from bzrlib.branch import Branch
26
 
from bzrlib.builtins import _merge_helper
 
26
from bzrlib.builtins import merge
27
27
from bzrlib.conflicts import ConflictList, TextConflict
28
28
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
29
29
from bzrlib.merge import transform_tree, merge_inner
41
41
        wt = self.make_branch_and_tree('.')
42
42
        rev_a = wt.commit("lala!")
43
43
        self.assertEqual([rev_a], wt.get_parent_ids())
44
 
        _merge_helper([u'.', -1], [None, None])
 
44
        merge([u'.', -1], [None, None])
45
45
        self.assertEqual([rev_a], wt.get_parent_ids())
46
46
 
47
47
    def test_undo(self):
49
49
        wt.commit("lala!")
50
50
        wt.commit("haha!")
51
51
        wt.commit("blabla!")
52
 
        _merge_helper([u'.', 2], [u'.', 1])
 
52
        merge([u'.', 2], [u'.', 1])
53
53
 
54
54
    def test_nocommits(self):
55
55
        self.test_pending()
56
56
        wt2 = self.make_branch_and_tree('branch2')
57
 
        self.assertRaises(NoCommits, _merge_helper, ['branch2', -1],
 
57
        self.assertRaises(NoCommits, merge, ['branch2', -1], 
58
58
                          [None, None])
59
59
        return wt2
60
60
 
61
61
    def test_unrelated(self):
62
62
        wt2 = self.test_nocommits()
63
63
        wt2.commit("blah")
64
 
        self.assertRaises(UnrelatedBranches, _merge_helper, ['branch2', -1],
 
64
        self.assertRaises(UnrelatedBranches, merge, ['branch2', -1], 
65
65
                          [None, None])
66
66
        return wt2
67
67
 
92
92
        br1.fetch(wt2.branch)
93
93
        # merge all of branch 2 into branch 1 even though they 
94
94
        # are not related.
95
 
        self.assertRaises(BzrCommandError, _merge_helper, ['branch2', -1],
 
95
        self.assertRaises(BzrCommandError, merge, ['branch2', -1],
96
96
                          ['branch2', 0], reprocess=True, show_base=True)
97
 
        _merge_helper(['branch2', -1], ['branch2', 0], reprocess=True)
 
97
        merge(['branch2', -1], ['branch2', 0], reprocess=True)
98
98
        self.assertEqual([br1.last_revision(), wt2.branch.last_revision()],
99
99
            wt1.get_parent_ids())
100
100
        return (wt1, wt2.branch)
270
270
            tree_b.merge_from_branch(tree_a.branch)
271
271
        except AttributeError:
272
272
            self.fail('tried to join a path when name was None')
273
 
 
274
 
    def test_merge_uncommitted_otherbasis_ancestor_of_thisbasis(self):
275
 
        tree_a = self.make_branch_and_tree('a')
276
 
        self.build_tree(['a/file_1', 'a/file_2'])
277
 
        tree_a.add(['file_1'])
278
 
        tree_a.commit('commit 1')
279
 
        tree_a.add(['file_2'])
280
 
        tree_a.commit('commit 2')
281
 
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
282
 
        tree_b.rename_one('file_1', 'renamed')
283
 
        _merge_helper(['b', None], ['b', -1], this_dir='a')
284
 
        self.assertEqual(tree_a.get_parent_ids(), [tree_b.last_revision()])