~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit_merge.py

  • Committer: Martin Pool
  • Date: 2006-08-10 01:16:16 UTC
  • mto: (1904.1.2 0.9)
  • mto: This revision was merged to the branch mainline in revision 1913.
  • Revision ID: mbp@sourcefrog.net-20060810011616-d74881eba696e746
compare_trees is deprecated in 0.9 not 0.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by 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
34
34
    def test_merge_commit_empty(self):
35
35
        """Simple commit of two-way merge of empty trees."""
36
36
        wtx = self.make_branch_and_tree('x')
37
 
        base_rev = wtx.commit('common parent')
38
37
        bx = wtx.branch
39
 
        wty = wtx.bzrdir.sprout('y').open_workingtree()
 
38
        wty = self.make_branch_and_tree('y')
40
39
        by = wty.branch
41
 
        
 
40
 
42
41
        wtx.commit('commit one', rev_id='x@u-0-1', allow_pointless=True)
43
42
        wty.commit('commit two', rev_id='y@u-0-1', allow_pointless=True)
44
43
 
48
47
                          wty.commit,
49
48
                          'no changes yet', rev_id='y@u-0-2',
50
49
                          allow_pointless=False)
51
 
        wty.merge_from_branch(bx)
 
50
        wty.add_pending_merge('x@u-0-1')
52
51
        wty.commit('merge from x', rev_id='y@u-0-2', allow_pointless=False)
53
52
 
54
 
        self.assertEquals(by.revno(), 3)
 
53
        self.assertEquals(by.revno(), 2)
55
54
        self.assertEquals(list(by.revision_history()),
56
 
                          [base_rev, 'y@u-0-1', 'y@u-0-2'])
 
55
                          ['y@u-0-1', 'y@u-0-2'])
57
56
        rev = by.repository.get_revision('y@u-0-2')
58
57
        self.assertEquals(rev.parent_ids,
59
58
                          ['y@u-0-1', 'x@u-0-1'])
61
60
    def test_merge_new_file(self):
62
61
        """Commit merge of two trees with no overlapping files."""
63
62
        wtx = self.make_branch_and_tree('x')
64
 
        base_rev = wtx.commit('common parent')
65
63
        bx = wtx.branch
66
 
        wtx.commit('establish root id')
67
 
        wty = wtx.bzrdir.sprout('y').open_workingtree()
68
 
        self.assertEqual(wtx.get_root_id(), wty.get_root_id())
 
64
        wty = self.make_branch_and_tree('y')
69
65
        by = wty.branch
70
66
 
71
67
        self.build_tree(['x/ecks', 'y/why'])
76
72
        wtx.commit('commit one', rev_id='x@u-0-1', allow_pointless=True)
77
73
        wty.commit('commit two', rev_id='y@u-0-1', allow_pointless=True)
78
74
 
79
 
        wty.merge_from_branch(bx)
 
75
        by.fetch(bx)
 
76
        # we haven't merged the texts, but let's fake it
 
77
        shutil.copyfile('x/ecks', 'y/ecks')
 
78
        wty.add(['ecks'], ['ecks-id'])
 
79
        wty.add_pending_merge('x@u-0-1')
80
80
 
81
81
        # partial commit of merges is currently not allowed, because
82
82
        # it would give different merge graphs for each file which