154
154
('foo/bar', None, 'bar-id', None)])
155
155
self.assertIs(None, wt.path2id('foo'))
157
def test_rename_dir_with_children(self):
158
wt = self.make_branch_and_tree('.')
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'))
170
def test_rename_dir_with_children_with_children(self):
171
wt = self.make_branch_and_tree('.')
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'))
157
184
def test_rename_file(self):
158
185
wt = self.make_branch_and_tree('.')
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',