/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_memorytree.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-22 18:12:25 UTC
  • mto: (3514.4.6 merge_lca_multi)
  • mto: This revision was merged to the branch mainline in revision 3590.
  • Revision ID: john@arbash-meinel.com-20080722181225-nx1dwfmb4wky600x
Revert back to using MemoryTree.mkdir() rather than creating the directory during add().

This complicates the api a bit, because we have to use multiple passes,
but at least we don't change any tested behavior.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        self.assertEqual('afile', tree.id2path(tree.path2id('afile')))
102
102
        self.assertEqual('adir', tree.id2path(tree.path2id('adir')))
103
103
        self.assertFalse(tree.has_filename('afile'))
104
 
        self.assertTrue(tree.has_filename('adir'))
 
104
        self.assertFalse(tree.has_filename('adir'))
105
105
        tree.unlock()
106
106
 
107
107
    def test_put_new_file(self):
130
130
        tree = MemoryTree.create_on_branch(branch)
131
131
        tree.lock_write()
132
132
        self.addCleanup(tree.unlock)
133
 
        tree.add(['', 'adir', 'adir/afile'], ['root-id', 'dir-id', 'file-id'],
134
 
                 ['directory', 'directory', 'file'])
 
133
        tree.add([''], ['root-id'], ['directory'])
 
134
        # Unfortunately, the only way to 'mkdir' is to call 'tree.mkdir', but
 
135
        # that *always* adds the directory as well. So if you want to create a
 
136
        # file in a subdirectory, you have to split out the 'mkdir()' calls
 
137
        # from the add and put_file_bytes_non_atomic calls. :(
 
138
        tree.mkdir('adir', 'dir-id')
 
139
        tree.add(['adir/afile'], ['file-id'], ['file'])
135
140
        self.assertEqual('adir/afile', tree.id2path('file-id'))
136
141
        self.assertEqual('adir', tree.id2path('dir-id'))
137
142
        tree.put_file_bytes_non_atomic('file-id', 'barshoom')