~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_memorytree.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        branch = self.make_branch('branch')
87
87
        tree = MemoryTree.create_on_branch(branch)
88
88
        tree.lock_write()
89
 
        tree.add(['', 'afile', 'adir'], None, 
90
 
                 ['directory', 'file', 'directory'])
 
89
        tree.add(['afile', 'adir'], None, ['file', 'directory'])
91
90
        self.assertEqual('afile', tree.id2path(tree.path2id('afile')))
92
91
        self.assertEqual('adir', tree.id2path(tree.path2id('adir')))
93
92
        self.assertFalse(tree.has_filename('afile'))
98
97
        branch = self.make_branch('branch')
99
98
        tree = MemoryTree.create_on_branch(branch)
100
99
        tree.lock_write()
101
 
        tree.add(['', 'foo'], ids=['root-id', 'foo-id'], 
102
 
                  kinds=['directory', 'file'])
 
100
        tree.add(['foo'], ids=['foo-id'], kinds=['file'])
103
101
        tree.put_file_bytes_non_atomic('foo-id', 'barshoom')
104
102
        self.assertEqual('barshoom', tree.get_file('foo-id').read())
105
103
        tree.unlock()
108
106
        branch = self.make_branch('branch')
109
107
        tree = MemoryTree.create_on_branch(branch)
110
108
        tree.lock_write()
111
 
        tree.add(['', 'foo'], ids=['root-id', 'foo-id'], 
112
 
                 kinds=['directory', 'file'])
 
109
        tree.add(['foo'], ids=['foo-id'], kinds=['file'])
113
110
        tree.put_file_bytes_non_atomic('foo-id', 'first-content')
114
111
        tree.put_file_bytes_non_atomic('foo-id', 'barshoom')
115
112
        self.assertEqual('barshoom', tree.get_file('foo-id').read())
124
121
        branch = self.make_branch('branch')
125
122
        tree = MemoryTree.create_on_branch(branch)
126
123
        tree.lock_write()
127
 
        tree.add(['', 'foo'], ids=['root-id', 'foo-id'], 
128
 
                 kinds=['directory', 'file'])
 
124
        tree.add(['foo'], ids=['foo-id'], kinds=['file'])
129
125
        tree.put_file_bytes_non_atomic('foo-id', 'barshoom')
130
126
        revision_id = tree.commit('message baby')
131
127
        # the parents list for the tree should have changed.
140
136
        branch = self.make_branch('branch')
141
137
        tree = MemoryTree.create_on_branch(branch)
142
138
        tree.lock_write()
143
 
        tree.add(['', 'foo'], ids=['root-id', 'foo-id'], 
144
 
                 kinds=['directory', 'file'])
 
139
        tree.add(['foo'], ids=['foo-id'], kinds=['file'])
145
140
        tree.unversion(['foo-id'])
146
141
        self.assertFalse(tree.has_id('foo-id'))
147
142
        tree.unlock()
148
 
 
149
 
    def test_last_revision(self):
150
 
        """There should be a last revision method we can call."""
151
 
        tree = self.make_branch_and_memory_tree('branch')
152
 
        tree.lock_write()
153
 
        tree.add('')
154
 
        rev_id = tree.commit('first post')
155
 
        tree.unlock()
156
 
        self.assertEqual(rev_id, tree.last_revision())