~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-12-21 02:25:16 UTC
  • mfrom: (1551.20.3 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 3187.
  • Revision ID: aaron.bentley@utoronto.ca-20071221022516-hd721fevdx6o7h8i
Merge from other bzr.ab

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
        self.failUnlessExists('sub/a.txt.BASE')
137
137
 
138
138
    def test_merge_remember(self):
139
 
        """Merge changes from one branch to another and test parent location."""
 
139
        """Merge changes from one branch to another, test submit location."""
140
140
        tree_a = self.make_branch_and_tree('branch_a')
141
141
        branch_a = tree_a.branch
142
142
        self.build_tree(['branch_a/a'])
166
166
        tree_b.add('d')
167
167
        self.run_bzr_error(['Working tree ".*" has uncommitted changes'],
168
168
                           'merge ../branch_a')
169
 
        self.assertEquals(abspath(branch_b.get_parent()), abspath(parent))
 
169
        self.assertEquals(abspath(branch_b.get_submit_branch()),
 
170
                          abspath(parent))
170
171
        # test implicit --remember after resolving conflict
171
172
        tree_b.commit('commit d')
172
173
        out, err = self.run_bzr('merge')
173
174
        
174
175
        base = urlutils.local_path_from_url(branch_a.base)
175
 
        self.assertEquals(out, 'Merging from remembered location %s\n' % (base,))
 
176
        self.assertEquals(out,
 
177
                          'Merging from remembered location %s\n' % (base,))
176
178
        self.assertEquals(err, '+N  b\nAll changes applied successfully.\n')
177
 
        self.assertEquals(abspath(branch_b.get_parent()), abspath(parent))
 
179
        self.assertEquals(abspath(branch_b.get_submit_branch()),
 
180
                          abspath(parent))
178
181
        # re-open tree as external run_bzr modified it
179
182
        tree_b = branch_b.bzrdir.open_workingtree()
180
183
        tree_b.commit('merge branch_a')
182
185
        out, err = self.run_bzr('merge ../branch_c --remember')
183
186
        self.assertEquals(out, '')
184
187
        self.assertEquals(err, '+N  c\nAll changes applied successfully.\n')
185
 
        self.assertEquals(abspath(branch_b.get_parent()),
 
188
        self.assertEquals(abspath(branch_b.get_submit_branch()),
186
189
                          abspath(branch_c.bzrdir.root_transport.base))
187
190
        # re-open tree as external run_bzr modified it
188
191
        tree_b = branch_b.bzrdir.open_workingtree()
407
410
        graph = tree_a.branch.repository.get_graph(tree_b.branch.repository)
408
411
        out, err = self.run_bzr(['merge', '-d', 'a', 'b'])
409
412
        self.assertContainsRe(err, 'Warning: criss-cross merge encountered.')
 
413
 
 
414
    def test_merge_from_submit(self):
 
415
        tree_a = self.make_branch_and_tree('a')
 
416
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
 
417
        tree_c = tree_a.bzrdir.sprout('c').open_workingtree()
 
418
        out, err = self.run_bzr(['merge', '-d', 'c'])
 
419
        self.assertContainsRe(out, 'Merging from remembered location .*a\/$')
 
420
        tree_c.branch.set_submit_branch(tree_b.bzrdir.root_transport.base)
 
421
        out, err = self.run_bzr(['merge', '-d', 'c'])
 
422
        self.assertContainsRe(out, 'Merging from remembered location .*b\/$')
 
423
 
 
424
    def test_remember_sets_submit(self):
 
425
        tree_a = self.make_branch_and_tree('a')
 
426
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
 
427
        self.assertIs(tree_b.branch.get_submit_branch(), None)
 
428
 
 
429
        # Remember should not happen if using default from parent
 
430
        out, err = self.run_bzr(['merge', '-d', 'b'])
 
431
        self.assertIs(tree_b.branch.get_submit_branch(), None)
 
432
 
 
433
        # Remember should happen if user supplies location
 
434
        out, err = self.run_bzr(['merge', '-d', 'b', 'a'])
 
435
        self.assertEqual(tree_b.branch.get_submit_branch(),
 
436
                         tree_a.bzrdir.root_transport.base)