/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/workingtree_implementations/test_commit.py

Add a new method ``Tree.revision_tree`` which allows access to cached
trees for arbitrary revisions. This allows the in development dirstate
tree format to provide access to the callers to cached copies of 
inventory data which are cheaper to access than inventories from the
repository. (Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        except errors.UpgradeRequired:
115
115
            # older format.
116
116
            return
117
 
        master.bzrdir.transport.put('branch-format', StringIO('garbage'))
 
117
        master.bzrdir.transport.put_bytes('branch-format', 'garbage')
118
118
        del master
119
119
        # check its corrupted.
120
120
        self.assertRaises(errors.UnknownFormatError,
163
163
            'wibble@fofof--20050401--1928390812'],
164
164
            rev.parent_ids)
165
165
 
 
166
    def test_commit_deleted_subtree_and_files_updates_workingtree(self):
 
167
        """The working trees inventory may be adjusted by commit."""
 
168
        wt = self.make_branch_and_tree('.')
 
169
        wt.lock_write()
 
170
        self.build_tree(['a', 'b/', 'b/c', 'd'])
 
171
        wt.add(['a', 'b', 'b/c', 'd'], ['a-id', 'b-id', 'c-id', 'd-id'])
 
172
        this_dir = self.get_transport()
 
173
        this_dir.delete_tree('b')
 
174
        this_dir.delete('d')
 
175
        # now we have a tree with a through d in the inventory, but only
 
176
        # a present on disk. After commit b-id, c-id and d-id should be
 
177
        # missing from the inventory, within the same tree transaction.
 
178
        wt.commit('commit stuff')
 
179
        self.assertTrue(wt.has_id('a-id'))
 
180
        self.assertFalse(wt.has_or_had_id('b-id'))
 
181
        self.assertFalse(wt.has_or_had_id('c-id'))
 
182
        self.assertFalse(wt.has_or_had_id('d-id'))
 
183
        self.assertTrue(wt.has_filename('a'))
 
184
        self.assertFalse(wt.has_filename('b'))
 
185
        self.assertFalse(wt.has_filename('b/c'))
 
186
        self.assertFalse(wt.has_filename('d'))
 
187
        wt.unlock()
 
188
        # the changes should have persisted to disk - reopen the workingtree
 
189
        # to be sure.
 
190
        wt = wt.bzrdir.open_workingtree()
 
191
        wt.lock_read()
 
192
        self.assertTrue(wt.has_id('a-id'))
 
193
        self.assertFalse(wt.has_or_had_id('b-id'))
 
194
        self.assertFalse(wt.has_or_had_id('c-id'))
 
195
        self.assertFalse(wt.has_or_had_id('d-id'))
 
196
        self.assertTrue(wt.has_filename('a'))
 
197
        self.assertFalse(wt.has_filename('b'))
 
198
        self.assertFalse(wt.has_filename('b/c'))
 
199
        self.assertFalse(wt.has_filename('d'))
 
200
        wt.unlock()
 
201
        
 
202
 
166
203
class TestCommitProgress(TestCaseWithWorkingTree):
167
204
    
168
205
    def restoreDefaults(self):