~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_commit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-07 23:06:08 UTC
  • mfrom: (1991.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060907230608-4f18ec1bbe03eb8f
(robertc) Improve performance of bzr commit by eliminating the need for one inventory parse.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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):