~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit_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
    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')
37
38
        bx = wtx.branch
38
 
        wty = self.make_branch_and_tree('y')
 
39
        wty = wtx.bzrdir.sprout('y').open_workingtree()
39
40
        by = wty.branch
40
 
 
 
41
        
41
42
        wtx.commit('commit one', rev_id='x@u-0-1', allow_pointless=True)
42
43
        wty.commit('commit two', rev_id='y@u-0-1', allow_pointless=True)
43
44
 
47
48
                          wty.commit,
48
49
                          'no changes yet', rev_id='y@u-0-2',
49
50
                          allow_pointless=False)
50
 
        wty.add_pending_merge('x@u-0-1')
 
51
        self.merge(bx, wty)
51
52
        wty.commit('merge from x', rev_id='y@u-0-2', allow_pointless=False)
52
53
 
53
 
        self.assertEquals(by.revno(), 2)
 
54
        self.assertEquals(by.revno(), 3)
54
55
        self.assertEquals(list(by.revision_history()),
55
 
                          ['y@u-0-1', 'y@u-0-2'])
 
56
                          [base_rev, 'y@u-0-1', 'y@u-0-2'])
56
57
        rev = by.repository.get_revision('y@u-0-2')
57
58
        self.assertEquals(rev.parent_ids,
58
59
                          ['y@u-0-1', 'x@u-0-1'])
60
61
    def test_merge_new_file(self):
61
62
        """Commit merge of two trees with no overlapping files."""
62
63
        wtx = self.make_branch_and_tree('x')
 
64
        base_rev = wtx.commit('common parent')
63
65
        bx = wtx.branch
64
 
        wty = self.make_branch_and_tree('y')
 
66
        wty = wtx.bzrdir.sprout('y').open_workingtree()
65
67
        by = wty.branch
66
68
 
67
69
        self.build_tree(['x/ecks', 'y/why'])
72
74
        wtx.commit('commit one', rev_id='x@u-0-1', allow_pointless=True)
73
75
        wty.commit('commit two', rev_id='y@u-0-1', allow_pointless=True)
74
76
 
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')
 
77
        self.merge(bx, wty)
80
78
 
81
79
        # partial commit of merges is currently not allowed, because
82
80
        # it would give different merge graphs for each file which