~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_smart_add.py

  • Committer: Jelmer Vernooij
  • Date: 2010-12-20 11:57:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5577.
  • Revision ID: jelmer@samba.org-20101220115714-2ru3hfappjweeg7q
Don't use no-plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Test that we can use smart_add on all Tree implementations."""
18
18
 
19
19
from cStringIO import StringIO
 
20
import os
20
21
import sys
21
22
 
22
23
from bzrlib import (
202
203
        self.assertEqual(['', 'dir', 'dir/subdir', 'dir/subdir/foo'],
203
204
            [path for path, ie in tree.iter_entries_by_dir()])
204
205
 
 
206
    def test_add_dir_bug_251864(self):
 
207
        """Added file turning into a dir should be detected on add dir
 
208
 
 
209
        Similar to bug 205636 but with automatic adding of directory contents.
 
210
        """
 
211
        tree = self.make_branch_and_tree(".")
 
212
        self.build_tree(["dir"]) # whoops, make a file called dir
 
213
        tree.smart_add(["dir"])
 
214
        os.remove("dir")
 
215
        self.build_tree(["dir/", "dir/file"])
 
216
        tree.smart_add(["dir"])
 
217
        tree.commit("Add dir contents")
 
218
        self.addCleanup(tree.lock_read().unlock)
 
219
        self.assertEqual([(u"dir", "directory"), (u"dir/file", "file")],
 
220
            [(t[0], t[2]) for t in tree.list_files()])
 
221
        self.assertFalse(list(tree.iter_changes(tree.basis_tree())))
 
222
 
 
223
    def test_add_subdir_file_bug_205636(self):
 
224
        """Added file turning into a dir should be detected on add dir/file"""
 
225
        tree = self.make_branch_and_tree(".")
 
226
        self.build_tree(["dir"]) # whoops, make a file called dir
 
227
        tree.smart_add(["dir"])
 
228
        os.remove("dir")
 
229
        self.build_tree(["dir/", "dir/file"])
 
230
        tree.smart_add(["dir/file"])
 
231
        tree.commit("Add file in dir")
 
232
        self.addCleanup(tree.lock_read().unlock)
 
233
        self.assertEqual([(u"dir", "directory"), (u"dir/file", "file")],
 
234
            [(t[0], t[2]) for t in tree.list_files()])
 
235
        self.assertFalse(list(tree.iter_changes(tree.basis_tree())))
 
236
 
205
237
    def test_custom_ids(self):
206
238
        sio = StringIO()
207
239
        action = test_smart_add.AddCustomIDAction(to_file=sio,