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