67
67
('foo/bar', None, 'bar-id', None)])
68
68
self.assertIs(None, wt.path2id('foo'))
70
def test_rename_dir_with_children(self):
71
wt = self.make_branch_and_tree('.')
73
root_id = wt.get_root_id()
74
self.addCleanup(wt.unlock)
75
self.build_tree(['foo/', 'foo/bar'])
76
wt.add(['foo', 'foo/bar'],
78
wt.apply_inventory_delta([('foo', 'baz', 'foo-id',
79
inventory.InventoryDirectory('foo-id', 'baz', root_id))])
80
# foo/bar should have been followed the rename of its parent to baz/bar
81
self.assertEqual('baz/bar', wt.id2path('bar-id'))
83
def test_rename_dir_with_children_with_children(self):
84
wt = self.make_branch_and_tree('.')
86
root_id = wt.get_root_id()
87
self.addCleanup(wt.unlock)
88
self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])
89
wt.add(['foo', 'foo/bar', 'foo/bar/baz'],
90
['foo-id', 'bar-id', 'baz-id'])
91
wt.apply_inventory_delta([('foo', 'quux', 'foo-id',
92
inventory.InventoryDirectory('foo-id', 'quux', root_id))])
93
# foo/bar/baz should have been followed the rename of its parent's
94
# parent to quux/bar/baz
95
self.assertEqual('quux/bar/baz', wt.id2path('baz-id'))
70
97
def test_rename_file(self):
71
98
wt = self.make_branch_and_tree('.')
73
root_id = wt.get_root_id()
74
100
self.addCleanup(wt.unlock)
75
101
self.build_tree(['foo/', 'foo/bar', 'baz/'])
76
102
wt.add(['foo', 'foo/bar', 'baz'],
110
136
self.build_tree(['dir/', 'dir/child', 'other/'])
111
137
wt.add(['dir', 'dir/child', 'other'],
112
138
['dir-id', 'child-id', 'other-id'])
139
# this delta moves dir-id to dir2 and reparents
140
# child-id to a parent of other-id
113
141
wt.apply_inventory_delta([('dir', 'dir2', 'dir-id',
114
142
inventory.InventoryDirectory('dir-id', 'dir2', root_id)),
115
143
('dir/child', 'other/child', 'child-id',