~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Marius Kruger
  • Date: 2007-04-13 18:45:26 UTC
  • mto: This revision was merged to the branch mainline in revision 2455.
  • Revision ID: amanic@gmail.com-20070413184526-6xhpgyvqz2u18l2q
move test_workingtree.TestRemove to workingtree_implementations/test_remove

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
        self.assertEqual(TreeLink().kind_character(), '')
64
64
 
65
65
 
66
 
 
67
 
class TestRemove(TestCaseWithTransport):
68
 
    """Tests WorkingTree.remove"""
69
 
 
70
 
    files=['a','b/','b/c']
71
 
    b = ['b']
72
 
    b_c = ['b','b/c']
73
 
    
74
 
    def getTree(self):
75
 
        self.makeAndChdirToTestDir()
76
 
        tree = self.make_branch_and_tree('.')
77
 
        self.build_tree(TestRemove.files)
78
 
        return tree
79
 
 
80
 
    def test_remove_unchanged_files(self):
81
 
        """check that unchanged files are removed and deleted."""
82
 
        tree = self.getTree()
83
 
        tree.add(TestRemove.files)
84
 
        tree.commit("files must not have changes")
85
 
 
86
 
        self.assertInWorkingTree(TestRemove.files)
87
 
 
88
 
        tree.remove(TestRemove.files, keep_files=False)
89
 
 
90
 
        self.assertNotInWorkingTree(TestRemove.files)
91
 
        self.failIfExists(TestRemove.files)
92
 
 
93
 
    def test_remove_changed_files(self):
94
 
        """check that changed files are removed but not deleted."""
95
 
        tree = self.getTree()
96
 
        tree.add(TestRemove.files)
97
 
        self.assertInWorkingTree(TestRemove.files)
98
 
 
99
 
        tree.remove(TestRemove.files, keep_files=False)
100
 
 
101
 
        self.assertNotInWorkingTree(TestRemove.files)
102
 
        self.failUnlessExists(TestRemove.files)
103
 
 
104
 
    def test_force_remove_changed_files(self):
105
 
        """check that changed files are removed and deleted when forced."""
106
 
        tree = self.getTree()
107
 
        tree.add(TestRemove.files)
108
 
        self.assertInWorkingTree(TestRemove.files)
109
 
 
110
 
        tree.remove(TestRemove.files, keep_files=False, force=True)
111
 
 
112
 
        self.assertNotInWorkingTree(TestRemove.files)
113
 
        self.failIfExists(TestRemove.files)
114
 
 
115
 
    def test_remove_nonexisting_files(self):
116
 
        """delete files which does not exist."""
117
 
        tree = self.getTree()
118
 
        tree.remove(TestRemove.files, keep_files=False)
119
 
        tree.remove([''], keep_files=False)
120
 
        tree.remove(TestRemove.b, keep_files=False)
121
 
 
122
 
    def test_remove_nonempty_directory(self):
123
 
        tree = self.getTree()
124
 
        tree.add(TestRemove.files)
125
 
        tree.commit("make sure b is versioned")
126
 
        self.assertInWorkingTree(TestRemove.files)
127
 
        self.failUnlessExists(TestRemove.files)
128
 
        tree.remove(TestRemove.b, keep_files=False)
129
 
        self.assertNotInWorkingTree(TestRemove.b)
130
 
        self.failUnlessExists(TestRemove.b)
131
 
 
132
 
    def test_force_remove_nonempty_directory(self):
133
 
        tree = self.getTree()
134
 
        tree.add(TestRemove.files)
135
 
        tree.commit("make sure b is versioned")
136
 
        self.assertInWorkingTree(TestRemove.files)
137
 
        self.failUnlessExists(TestRemove.files)
138
 
        tree.remove(TestRemove.b, keep_files=False, force=True)
139
 
        self.assertNotInWorkingTree(TestRemove.b_c)
140
 
        self.failIfExists(TestRemove.b_c)
141
 
 
142
 
    def test_remove_keep(self):
143
 
        """check that files are unversioned but not delete."""
144
 
        tree = self.getTree()
145
 
        tree.add(TestRemove.files)
146
 
        self.assertInWorkingTree(TestRemove.files)
147
 
 
148
 
        tree.remove(TestRemove.files)
149
 
        self.assertNotInWorkingTree(TestRemove.files)
150
 
        self.failUnlessExists(TestRemove.files)
151
 
 
152
66
class TestDefaultFormat(TestCaseWithTransport):
153
67
 
154
68
    def test_get_set_default_format(self):