~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-08 07:32:48 UTC
  • mfrom: (5138.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100408073248-aj7k8qkvbv4nzlxd
(igc for parthm) update -r dotted-revno support

Show diffs side-by-side

added added

removed removed

Lines of Context:
263
263
        self.assertEquals(['m1'], master.get_parent_ids())
264
264
 
265
265
    def test_update_dash_r_outside_history(self):
 
266
        """Ensure that we can update -r to dotted revisions.
 
267
        """
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')
270
272
 
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')
 
278
        other.add(['file3'])
 
279
        other.commit('other3', rev_id='o3')
276
280
 
277
281
        os.chdir('master')
278
282
        self.run_bzr('merge ../other')
279
283
        master.commit('merge', rev_id='merge')
280
284
 
281
 
        out, err = self.run_bzr('update -r revid:o2',
282
 
                                retcode=3)
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',
287
 
                         err)
 
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 .*')
 
290
 
 
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 .*')
288
296
 
289
297
    def test_update_dash_r_in_master(self):
290
298
        # Test that 'bzr update' works correctly when you have