~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(gz) Remove bzrlib/util/elementtree/ package (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Tests for the update command of bzr."""
19
19
 
20
20
import os
21
 
import re
22
21
 
23
22
from bzrlib import (
24
23
    branch,
25
24
    bzrdir,
26
25
    osutils,
27
26
    tests,
28
 
    urlutils,
29
27
    workingtree,
30
28
    )
31
29
from bzrlib.tests.script import ScriptRunner
140
138
        # smoke test for doing an update of a checkout of a bound
141
139
        # branch with local commits.
142
140
        master = self.make_branch_and_tree('master')
 
141
        master.commit('first commit')
143
142
        # make a bound branch
144
143
        self.run_bzr('checkout master child')
145
 
        # get an object form of child
146
 
        child = workingtree.WorkingTree.open('child')
147
144
        # check that out
148
145
        self.run_bzr('checkout --lightweight child checkout')
149
146
        # get an object form of the checkout to manipulate
158
155
        a_file = file('child/file_b', 'wt')
159
156
        a_file.write('Foo')
160
157
        a_file.close()
 
158
        # get an object form of child
 
159
        child = workingtree.WorkingTree.open('child')
161
160
        child.add(['file_b'])
162
161
        child_tip = child.commit('add file_b', local=True)
163
162
        # check checkout
174
173
All changes applied successfully.
175
174
+N  file
176
175
All changes applied successfully.
177
 
Updated to revision 1 of branch %s
 
176
Updated to revision 2 of branch %s
178
177
Your local commits will now show as pending merges with 'bzr status', and can be committed with 'bzr commit'.
179
178
""" % osutils.pathjoin(self.test_dir, 'master',),
180
179
                         err)
455
454
>>>>>>> MERGE-SOURCE
456
455
''',
457
456
                             'lightweight/file')
 
457
 
 
458
 
 
459
    def test_no_upgrade_single_file(self):
 
460
        """There's one basis revision per tree.
 
461
 
 
462
        Since you can't actually change the basis for a single file at the
 
463
        moment, we don't let you think you can.
 
464
 
 
465
        See bug 557886.
 
466
        """
 
467
        self.make_branch_and_tree('.')
 
468
        self.build_tree_contents([('a/',),
 
469
            ('a/file', 'content')])
 
470
        sr = ScriptRunner()
 
471
        sr.run_script(self, '''
 
472
            $ bzr update ./a
 
473
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
474
            $ bzr update ./a/file
 
475
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
476
            $ bzr update .
 
477
            2>Tree is up to date at revision 0 of branch ...
 
478
            $ cd a
 
479
            $ bzr update .
 
480
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
481
            # however, you can update the whole tree from a subdirectory
 
482
            $ bzr update
 
483
            2>Tree is up to date at revision 0 of branch ...
 
484
            ''')