~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-15 00:44:57 UTC
  • mfrom: (2009 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2050.
  • Revision ID: john@arbash-meinel.com-20060915004457-902cec0526a39337
[merge] bzr.dev 2009

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        os.mkdir('a')
53
53
        os.chdir('a')
54
54
        self.example_branch()
 
55
        ancestor = Branch.open('.').revno()
55
56
        os.chdir('..')
56
57
        self.runbzr('branch a b')
57
58
        os.chdir('b')
62
63
        file('hello', 'wt').write('quuux')
63
64
        # We can't merge when there are in-tree changes
64
65
        self.runbzr('merge ../b', retcode=3)
65
 
        self.runbzr(['commit', '-m', "Like an epidemic of u's"])
 
66
        a = WorkingTree.open('.')
 
67
        a_tip = a.commit("Like an epidemic of u's")
66
68
        self.runbzr('merge ../b -r last:1..last:1 --merge-type blooof',
67
69
                    retcode=3)
68
70
        self.runbzr('merge ../b -r last:1..last:1 --merge-type merge3')
74
76
        self.runbzr('merge ../b -r last:1')
75
77
        self.check_file_contents('goodbye', 'quux')
76
78
        # Merging a branch pulls its revision into the tree
77
 
        a = WorkingTree.open('.')
78
79
        b = Branch.open('../b')
79
 
        a.branch.repository.get_revision_xml(b.last_revision())
80
 
        self.log('pending merges: %s', a.pending_merges())
 
80
        b_tip = b.last_revision()
 
81
        self.failUnless(a.branch.repository.has_revision(b_tip))
 
82
        self.assertEqual([a_tip, b_tip], a.get_parent_ids())
 
83
        self.runbzr('revert --no-backup')
 
84
        out, err = self.runbzr('merge -r revno:1:./hello', retcode=3)
 
85
        self.assertTrue("Not a branch" in err)
 
86
        self.runbzr('merge -r revno:%d:./..revno:%d:../b'
 
87
                    %(ancestor,b.revno()))
 
88
        self.assertEquals(a.pending_merges(), [b.last_revision()])
 
89
        self.check_file_contents('goodbye', 'quux')
 
90
        self.runbzr('revert --no-backup')
 
91
        self.runbzr('merge -r revno:%d:../b'%b.revno())
81
92
        self.assertEquals(a.pending_merges(),
82
93
                          [b.last_revision()])
83
 
        self.runbzr('commit -m merged')
 
94
        a_tip = a.commit('merged')
84
95
        self.runbzr('merge ../b -r last:1')
85
 
        self.assertEqual(a.pending_merges(), [])
 
96
        self.assertEqual([a_tip], a.get_parent_ids())
86
97
 
87
98
    def test_merge_with_missing_file(self):
88
99
        """Merge handles missing file conflicts"""
195
206
        file('../bundle', 'wb').write(self.runbzr('bundle ../branch_a')[0])
196
207
        os.chdir('../branch_a')
197
208
        self.runbzr('merge ../bundle', retcode=1)
198
 
        testament_a = Testament.from_revision(tree_a.branch.repository, 
199
 
                                              tree_b.last_revision())
 
209
        testament_a = Testament.from_revision(tree_a.branch.repository,
 
210
                                              tree_b.get_parent_ids()[0])
200
211
        testament_b = Testament.from_revision(tree_b.branch.repository,
201
 
                                              tree_b.last_revision())
 
212
                                              tree_b.get_parent_ids()[0])
202
213
        self.assertEqualDiff(testament_a.as_text(),
203
214
                         testament_b.as_text())
204
215
        tree_a.set_conflicts(ConflictList())