/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_update.py

  • Committer: Martin Pool
  • Date: 2009-12-22 05:24:50 UTC
  • mfrom: (2009.1.6 update-r.work)
  • mto: This revision was merged to the branch mainline in revision 4923.
  • Revision ID: mbp@sourcefrog.net-20091222052450-3kuapuya2ivekio1
Merge and reconcile very old branch for 'update -r'

Show diffs side-by-side

added added

removed removed

Lines of Context:
239
239
                                                   lightweight=True)
240
240
        tree.commit('empty commit')
241
241
        self.run_bzr('update checkout')
 
242
 
 
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')
 
248
        os.chdir('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')
 
255
 
 
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',
 
264
        #                         'm1')
 
265
 
 
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')
 
274
 
 
275
        # Create a second branch, with an extra commit
 
276
        other = master.bzrdir.sprout('other').open_workingtree()
 
277
        self.build_tree(['other/file2'])
 
278
        other.add(['file2'])
 
279
        other.commit('other2', rev_id='o2')
 
280
 
 
281
        os.chdir('master')
 
282
        self.run_bzr('merge ../other')
 
283
        master.commit('merge', rev_id='merge')
 
284
 
 
285
        out, err = self.run_bzr('update -r revid:o2',
 
286
                                retcode=3)
 
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',
 
291
                         err)
 
292
 
 
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')
 
300
 
 
301
        self.run_bzr('checkout master checkout')
 
302
 
 
303
        # add a revision in the master.
 
304
        self.build_tree(['master/file2'])
 
305
        master.add(['file2'])
 
306
        master.commit('two', rev_id='m2')
 
307
 
 
308
        os.chdir('checkout')
 
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)