263
263
self.assertEquals(['m1'], master.get_parent_ids())
265
265
def test_update_dash_r_outside_history(self):
266
"""Ensure that we can update -r to dotted revisions.
266
268
master = self.make_branch_and_tree('master')
267
269
self.build_tree(['master/file1'])
268
270
master.add(['file1'])
269
271
master.commit('one', rev_id='m1')
271
# Create a second branch, with an extra commit
273
# Create a second branch, with extra commits
272
274
other = master.bzrdir.sprout('other').open_workingtree()
273
self.build_tree(['other/file2'])
275
self.build_tree(['other/file2', 'other/file3'])
274
276
other.add(['file2'])
275
277
other.commit('other2', rev_id='o2')
279
other.commit('other3', rev_id='o3')
277
281
os.chdir('master')
278
282
self.run_bzr('merge ../other')
279
283
master.commit('merge', rev_id='merge')
281
out, err = self.run_bzr('update -r revid:o2',
283
self.assertEqual('', out)
284
self.assertEqual('bzr: ERROR: branch has no revision o2\n'
285
'bzr update --revision only works'
286
' for a revision in the branch history\n',
285
# Switch to o2. file3 was added only in o3 and should be deleted.
286
out, err = self.run_bzr('update -r revid:o2')
287
self.assertContainsRe(err, '-D\s+file3')
288
self.assertContainsRe(err, 'All changes applied successfully\.')
289
self.assertContainsRe(err, 'Updated to revision 1.1.1 of branch .*')
291
# Switch back to latest
292
out, err = self.run_bzr('update')
293
self.assertContainsRe(err, '\+N\s+file3')
294
self.assertContainsRe(err, 'All changes applied successfully\.')
295
self.assertContainsRe(err, 'Updated to revision 2 of branch .*')
289
297
def test_update_dash_r_in_master(self):
290
298
# Test that 'bzr update' works correctly when you have