195
195
# The pending merges should still be there
196
196
self.assertEqual(['o2'], checkout1.pending_merges())
198
def test_update_dash_r(self):
199
# Test that 'bzr update' works correctly when you have
200
# an update in the master tree, and a lightweight checkout
201
# which has merged another branch
202
master = self.make_branch_and_tree('master')
204
self.build_tree(['./file1'])
205
master.add(['file1'])
206
master.commit('one', rev_id='m1')
207
self.build_tree(['./file2'])
208
master.add(['file2'])
209
master.commit('two', rev_id='m2')
211
out, err = self.run_bzr('update', '-r', '1')
212
self.assertEqual('', out)
213
self.assertEqual('All changes applied successfully.\n'
214
'Updated to revision 1.\n', err)
215
self.failUnlessExists('./file1')
216
self.failIfExists('./file2')
217
self.check_file_contents('.bzr/checkout/last-revision',
220
def test_update_dash_r_outside_history(self):
221
# Test that 'bzr update' works correctly when you have
222
# an update in the master tree, and a lightweight checkout
223
# which has merged another branch
224
master = self.make_branch_and_tree('master')
225
self.build_tree(['master/file1'])
226
master.add(['file1'])
227
master.commit('one', rev_id='m1')
229
# Create a second branch, with an extra commit
230
other = master.bzrdir.sprout('other').open_workingtree()
231
self.build_tree(['other/file2'])
233
other.commit('other2', rev_id='o2')
236
self.run_bzr('merge', '../other')
237
master.commit('merge', rev_id='merge')
239
out, err = self.run_bzr('update', '-r', 'revid:o2',
241
self.assertEqual('', out)
242
self.assertEqual('bzr: ERROR: branch has no revision o2\n'
243
'bzr update --revision works only'
244
' for a revision in the branch history\n',
247
def test_update_dash_r_in_master(self):
248
# Test that 'bzr update' works correctly when you have
249
# an update in the master tree,
250
master = self.make_branch_and_tree('master')
251
self.build_tree(['master/file1'])
252
master.add(['file1'])
253
master.commit('one', rev_id='m1')
255
self.run_bzr('checkout', 'master', 'checkout')
257
# add a revision in the master.
258
self.build_tree(['master/file2'])
259
master.add(['file2'])
260
master.commit('two', rev_id='m2')
263
out, err = self.run_bzr('update', '-r', 'revid:m2')
264
self.assertEqual('', out)
265
self.assertEqual('All changes applied successfully.\n'
266
'Updated to revision 2.\n', err)