/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_inv.py

(robertc) Add a method to allow commit to give the working tree a delta to update its basis tree to the new basis tree. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
                                  ('foo/bar', None, 'bar-id', None)])
155
155
        self.assertIs(None, wt.path2id('foo'))
156
156
 
 
157
    def test_rename_dir_with_children(self):
 
158
        wt = self.make_branch_and_tree('.')
 
159
        wt.lock_write()
 
160
        root_id = wt.get_root_id()
 
161
        self.addCleanup(wt.unlock)
 
162
        self.build_tree(['foo/', 'foo/bar'])
 
163
        wt.add(['foo', 'foo/bar'],
 
164
               ['foo-id', 'bar-id'])
 
165
        wt.apply_inventory_delta([('foo', 'baz', 'foo-id',
 
166
            inventory.InventoryDirectory('foo-id', 'baz', root_id))])
 
167
        # foo/bar should have been followed the rename of its parent to baz/bar
 
168
        self.assertEqual('baz/bar', wt.id2path('bar-id'))
 
169
 
 
170
    def test_rename_dir_with_children_with_children(self):
 
171
        wt = self.make_branch_and_tree('.')
 
172
        wt.lock_write()
 
173
        root_id = wt.get_root_id()
 
174
        self.addCleanup(wt.unlock)
 
175
        self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])
 
176
        wt.add(['foo', 'foo/bar', 'foo/bar/baz'],
 
177
               ['foo-id', 'bar-id', 'baz-id'])
 
178
        wt.apply_inventory_delta([('foo', 'quux', 'foo-id',
 
179
            inventory.InventoryDirectory('foo-id', 'quux', root_id))])
 
180
        # foo/bar/baz should have been followed the rename of its parent's
 
181
        # parent to quux/bar/baz
 
182
        self.assertEqual('quux/bar/baz', wt.id2path('baz-id'))
 
183
 
157
184
    def test_rename_file(self):
158
185
        wt = self.make_branch_and_tree('.')
159
186
        wt.lock_write()
160
 
        root_id = wt.get_root_id()
161
187
        self.addCleanup(wt.unlock)
162
188
        self.build_tree(['foo/', 'foo/bar', 'baz/'])
163
189
        wt.add(['foo', 'foo/bar', 'baz'],
197
223
        self.build_tree(['dir/', 'dir/child', 'other/'])
198
224
        wt.add(['dir', 'dir/child', 'other'],
199
225
               ['dir-id', 'child-id', 'other-id'])
 
226
        # this delta moves dir-id to dir2 and reparents 
 
227
        # child-id to a parent of other-id
200
228
        wt.apply_inventory_delta([('dir', 'dir2', 'dir-id',
201
229
            inventory.InventoryDirectory('dir-id', 'dir2', root_id)),
202
230
            ('dir/child', 'other/child', 'child-id',