~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-06-04 10:10:50 UTC
  • mfrom: (5268.3.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20100604101050-5iiiag2n2soczg1l
(mbp) remove-tree now refuses to run without --force if there are shelved
 changes. (#586639) (Matt Giuca)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
 
 
22
from bzrlib import shelf
22
23
from bzrlib.tests.blackbox import ExternalBase
23
24
 
24
25
 
155
156
        self.run_bzr('remove-tree branch2 --force')
156
157
        self.failIfExists('branch2/foo')
157
158
        self.failIfExists('branch2/bar')
 
159
 
 
160
    def test_remove_tree_shelved_changes(self):
 
161
        # https://bugs.launchpad.net/bzr/+bug/586639
 
162
        tree = self.make_branch_and_tree('.')
 
163
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
 
164
        self.addCleanup(creator.finalize)
 
165
        shelf_id = tree.get_shelf_manager().shelve_changes(creator, 'Foo')
 
166
        output = self.run_bzr_error(["Working tree .* has shelved changes"],
 
167
                                    'remove-tree', retcode=3)
 
168
 
 
169
    def test_remove_tree_shelved_changes_force(self):
 
170
        tree = self.make_branch_and_tree('.')
 
171
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
 
172
        self.addCleanup(creator.finalize)
 
173
        shelf_id = tree.get_shelf_manager().shelve_changes(creator, 'Foo')
 
174
        self.run_bzr('remove-tree --force')
 
175
        self.run_bzr('checkout')
 
176
        # Ensure shelf is empty
 
177
        self.assertIs(None, tree.get_shelf_manager().last_shelf())