241
241
tree.commit('empty commit')
242
242
self.run_bzr('update checkout')
244
def test_update_with_merge_merged_to_master(self):
245
# Test that 'bzr update' works correctly when you have
246
# an update in the master tree, and a [lightweight or otherwise]
247
# checkout which has merge a revision merged to master already.
248
master = self.make_branch_and_tree('master')
249
self.build_tree(['master/file'])
251
master.commit('one', rev_id='m1')
253
self.build_tree(['checkout1/'])
254
checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
255
branch.BranchReferenceFormat().initialize(checkout_dir,
256
target_branch=master.branch)
257
checkout1 = checkout_dir.create_workingtree('m1')
259
# Create a second branch, with an extra commit
260
other = master.bzrdir.sprout('other').open_workingtree()
261
self.build_tree(['other/file2'])
263
other.commit('other2', rev_id='o2')
265
# Merge the other branch into checkout - 'start reviewing a patch'
266
checkout1.merge_from_branch(other.branch)
267
self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
269
# Create a new commit in the master branch - 'someone else lands its'
270
master.merge_from_branch(other.branch)
271
master.commit('f3', rev_id='m2')
273
# This should not report about local commits being pending
274
# merges, because they were real merges (but are now gone).
275
# It should perhaps report on them.
276
out, err = self.run_bzr('update', working_dir='checkout1')
277
self.assertEqual('', out)
278
self.assertEqualDiff('''All changes applied successfully.
279
Updated to revision 2 of branch %s
280
''' % osutils.pathjoin(self.test_dir, 'master',),
282
# The pending merges should still be there
283
self.assertEqual([], checkout1.get_parent_ids()[1:])
285
244
def test_update_dash_r(self):
286
245
master = self.make_branch_and_tree('master')
287
246
os.chdir('master')