239
239
lightweight=True)
240
240
tree.commit('empty commit')
241
241
self.run_bzr('update checkout')
243
def test_update_dash_r(self):
244
# Test that 'bzr update' works correctly when you have
245
# an update in the master tree, and a lightweight checkout
246
# which has merged another branch
247
master = self.make_branch_and_tree('master')
249
self.build_tree(['./file1'])
250
master.add(['file1'])
251
master.commit('one', rev_id='m1')
252
self.build_tree(['./file2'])
253
master.add(['file2'])
254
master.commit('two', rev_id='m2')
256
out, err = self.run_bzr('update -r 1')
257
self.assertEqual('', out)
258
self.assertEqual('-D file2\nAll changes applied successfully.\n'
259
'Updated to revision 1.\n', err)
260
self.failUnlessExists('./file1')
261
self.failIfExists('./file2')
262
# hrm - the below doesn't look correct for all formats...
263
#self.check_file_contents('.bzr/checkout/last-revision',
266
def test_update_dash_r_outside_history(self):
267
# Test that 'bzr update' works correctly when you have
268
# an update in the master tree, and a lightweight checkout
269
# which has merged another branch
270
master = self.make_branch_and_tree('master')
271
self.build_tree(['master/file1'])
272
master.add(['file1'])
273
master.commit('one', rev_id='m1')
275
# Create a second branch, with an extra commit
276
other = master.bzrdir.sprout('other').open_workingtree()
277
self.build_tree(['other/file2'])
279
other.commit('other2', rev_id='o2')
282
self.run_bzr('merge ../other')
283
master.commit('merge', rev_id='merge')
285
out, err = self.run_bzr('update -r revid:o2',
287
self.assertEqual('', out)
288
self.assertEqual('bzr: ERROR: branch has no revision o2\n'
289
'bzr update --revision only works'
290
' for a revision in the branch history\n',
293
def test_update_dash_r_in_master(self):
294
# Test that 'bzr update' works correctly when you have
295
# an update in the master tree,
296
master = self.make_branch_and_tree('master')
297
self.build_tree(['master/file1'])
298
master.add(['file1'])
299
master.commit('one', rev_id='m1')
301
self.run_bzr('checkout master checkout')
303
# add a revision in the master.
304
self.build_tree(['master/file2'])
305
master.add(['file2'])
306
master.commit('two', rev_id='m2')
309
out, err = self.run_bzr('update -r revid:m2')
310
self.assertEqual('', out)
311
self.assertEqual('+N file2\nAll changes applied successfully.\n'
312
'Updated to revision 2.\n', err)