/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: John Arbash Meinel
  • Date: 2010-01-05 04:30:07 UTC
  • mfrom: (4932 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4934.
  • Revision ID: john@arbash-meinel.com-20100105043007-ehgbldqd3q0gtyws
Merge bzr.dev, resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2009 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
32
33
 
33
34
 
34
35
class TestUpdate(tests.TestCaseWithTransport):
67
68
    def test_update_up_to_date_checkout(self):
68
69
        self.make_branch_and_tree('branch')
69
70
        self.run_bzr('checkout branch checkout')
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)
 
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
''')
75
76
 
76
77
    def test_update_out_of_date_standalone_tree(self):
77
78
        # FIXME the default format has to change for this to pass
239
240
                                                   lightweight=True)
240
241
        tree.commit('empty commit')
241
242
        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
''')