~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge cleanup into texinfo

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
19
19
 
20
20
import os
21
21
 
22
 
from bzrlib.tests.blackbox import ExternalBase
23
 
 
24
 
 
25
 
class TestRemoveTree(ExternalBase):
 
22
from bzrlib import shelf
 
23
from bzrlib.tests import TestCaseWithTransport
 
24
 
 
25
 
 
26
class TestRemoveTree(TestCaseWithTransport):
26
27
 
27
28
    def setUp(self):
28
29
        super(TestRemoveTree, self).setUp()
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())