~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-12-22 04:07:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4917.
  • Revision ID: mbp@sourcefrog.net-20091222040736-079e2r91hea7a40l
Rename to -Dno_activity; incidentally fixes ReST syntax error

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2009 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
29
29
    urlutils,
30
30
    workingtree,
31
31
    )
32
 
from bzrlib.tests.script import ScriptRunner
33
32
 
34
33
 
35
34
class TestUpdate(tests.TestCaseWithTransport):
68
67
    def test_update_up_to_date_checkout(self):
69
68
        self.make_branch_and_tree('branch')
70
69
        self.run_bzr('checkout branch checkout')
71
 
        sr = ScriptRunner()
72
 
        sr.run_script(self, '''
73
 
$ bzr update checkout
74
 
2>Tree is up to date at revision 0 of branch .../branch
75
 
''')
 
70
        out, err = self.run_bzr('update checkout')
 
71
        self.assertEqual('Tree is up to date at revision 0 of branch %s\n'
 
72
                         % osutils.pathjoin(self.test_dir, 'branch'),
 
73
                         err)
 
74
        self.assertEqual('', out)
76
75
 
77
76
    def test_update_out_of_date_standalone_tree(self):
78
77
        # FIXME the default format has to change for this to pass
240
239
                                                   lightweight=True)
241
240
        tree.commit('empty commit')
242
241
        self.run_bzr('update checkout')
243
 
 
244
 
    def test_update_dash_r(self):
245
 
        # Test that 'bzr update' works correctly when you have
246
 
        # an update in the master tree, and a lightweight checkout
247
 
        # which has merged another branch
248
 
        master = self.make_branch_and_tree('master')
249
 
        os.chdir('master')
250
 
        self.build_tree(['./file1'])
251
 
        master.add(['file1'])
252
 
        master.commit('one', rev_id='m1')
253
 
        self.build_tree(['./file2'])
254
 
        master.add(['file2'])
255
 
        master.commit('two', rev_id='m2')
256
 
 
257
 
        sr = ScriptRunner()
258
 
        sr.run_script(self, '''
259
 
$ bzr update -r 1
260
 
2>-D  file2
261
 
2>All changes applied successfully.
262
 
2>Updated to revision 1 of .../master
263
 
''')
264
 
        self.failUnlessExists('./file1')
265
 
        self.failIfExists('./file2')
266
 
        self.assertEquals(['m1'], master.get_parent_ids())
267
 
 
268
 
    def test_update_dash_r_outside_history(self):
269
 
        # Test that 'bzr update' works correctly when you have
270
 
        # an update in the master tree, and a lightweight checkout
271
 
        # which has merged another branch
272
 
        master = self.make_branch_and_tree('master')
273
 
        self.build_tree(['master/file1'])
274
 
        master.add(['file1'])
275
 
        master.commit('one', rev_id='m1')
276
 
 
277
 
        # Create a second branch, with an extra commit
278
 
        other = master.bzrdir.sprout('other').open_workingtree()
279
 
        self.build_tree(['other/file2'])
280
 
        other.add(['file2'])
281
 
        other.commit('other2', rev_id='o2')
282
 
 
283
 
        os.chdir('master')
284
 
        self.run_bzr('merge ../other')
285
 
        master.commit('merge', rev_id='merge')
286
 
 
287
 
        out, err = self.run_bzr('update -r revid:o2',
288
 
                                retcode=3)
289
 
        self.assertEqual('', out)
290
 
        self.assertEqual('bzr: ERROR: branch has no revision o2\n'
291
 
                         'bzr update --revision only works'
292
 
                         ' for a revision in the branch history\n',
293
 
                         err)
294
 
 
295
 
    def test_update_dash_r_in_master(self):
296
 
        # Test that 'bzr update' works correctly when you have
297
 
        # an update in the master tree,
298
 
        master = self.make_branch_and_tree('master')
299
 
        self.build_tree(['master/file1'])
300
 
        master.add(['file1'])
301
 
        master.commit('one', rev_id='m1')
302
 
 
303
 
        self.run_bzr('checkout master checkout')
304
 
 
305
 
        # add a revision in the master.
306
 
        self.build_tree(['master/file2'])
307
 
        master.add(['file2'])
308
 
        master.commit('two', rev_id='m2')
309
 
 
310
 
        os.chdir('checkout')
311
 
        sr = ScriptRunner()
312
 
        sr.run_script(self, '''
313
 
$ bzr update -r revid:m2
314
 
2>+N  file2
315
 
2>All changes applied successfully.
316
 
2>Updated to revision 2 of branch .../master
317
 
''')