829
832
self.build_tree(['tree2/file', 'tree2/dir/',
830
833
'tree1/file', 'tree2/movedfile',
831
834
'tree1/dir/', 'tree2/moveddir/'])
833
os.symlink('target', 'tree1/link')
834
os.symlink('target', 'tree2/link')
835
os.symlink('target', 'tree2/movedlink')
836
links_supported = True
838
# links_supported = False
839
tree1.add(['file', 'dir', 'link'], ['file-id', 'dir-id', 'link-id'])
840
tree2.add(['movedfile', 'moveddir', 'movedlink'],
841
['file-id', 'dir-id', 'link-id'])
836
os.symlink('target', 'tree1/link')
837
os.symlink('target', 'tree2/link')
838
os.symlink('target', 'tree2/movedlink')
839
links_supported = True
841
links_supported = False
842
tree1.add(['file', 'dir'], ['file-id', 'dir-id'])
843
tree2.add(['movedfile', 'moveddir'], ['file-id', 'dir-id'])
845
tree1.add(['link'], ['link-id'])
846
tree2.add(['movedlink'], ['link-id'])
842
847
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
843
848
root_id = tree1.path2id('')
1211
1216
self.assertEqual([], # Without want_unversioned we should get nothing
1212
1217
self.do_iter_changes(tree1, tree2,
1213
1218
specific_files=[u'\u03b1']))
1220
def test_unknown_empty_dir(self):
1221
tree1 = self.make_branch_and_tree('tree1')
1222
tree2 = self.make_to_branch_and_tree('tree2')
1223
root_id = tree1.get_root_id()
1224
tree2.set_root_id(root_id)
1226
# Start with 2 identical trees
1227
self.build_tree(['tree1/a/', 'tree1/b/',
1228
'tree2/a/', 'tree2/b/'])
1229
self.build_tree_contents([('tree1/b/file', 'contents\n'),
1230
('tree2/b/file', 'contents\n')])
1231
tree1.add(['a', 'b', 'b/file'], ['a-id', 'b-id', 'b-file-id'])
1232
tree2.add(['a', 'b', 'b/file'], ['a-id', 'b-id', 'b-file-id'])
1234
# Now create some unknowns in tree2
1235
# We should find both a/file and a/dir as unknown, but we shouldn't
1236
# recurse into a/dir to find that a/dir/subfile is also unknown.
1237
self.build_tree(['tree2/a/file', 'tree2/a/dir/', 'tree2/a/dir/subfile'])
1239
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1242
self.unversioned(tree2, u'a/file'),
1243
self.unversioned(tree2, u'a/dir'),
1245
self.assertEqual(expected,
1246
self.do_iter_changes(tree1, tree2,
1247
require_versioned=False,
1248
want_unversioned=True))
1250
def test_rename_over_deleted(self):
1251
tree1 = self.make_branch_and_tree('tree1')
1252
tree2 = self.make_to_branch_and_tree('tree2')
1253
root_id = tree1.get_root_id()
1254
tree2.set_root_id(root_id)
1256
# The final changes should be:
1263
self.build_tree_contents([
1264
('tree1/a', 'a contents\n'),
1265
('tree1/b', 'b contents\n'),
1266
('tree1/c', 'c contents\n'),
1267
('tree1/d', 'd contents\n'),
1268
('tree2/a', 'b contents\n'),
1269
('tree2/d', 'c contents\n'),
1271
tree1.add(['a', 'b', 'c', 'd'], ['a-id', 'b-id', 'c-id', 'd-id'])
1272
tree2.add(['a', 'd'], ['b-id', 'c-id'])
1274
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1277
self.deleted(tree1, 'a-id'),
1278
self.deleted(tree1, 'd-id'),
1279
self.renamed(tree1, tree2, 'b-id', False),
1280
self.renamed(tree1, tree2, 'c-id', False),
1282
self.assertEqual(expected,
1283
self.do_iter_changes(tree1, tree2))
1285
def test_deleted_and_unknown(self):
1286
"""Test a file marked removed, but still present on disk."""
1287
tree1 = self.make_branch_and_tree('tree1')
1288
tree2 = self.make_to_branch_and_tree('tree2')
1289
root_id = tree1.get_root_id()
1290
tree2.set_root_id(root_id)
1292
# The final changes should be:
1295
self.build_tree_contents([
1296
('tree1/a', 'a contents\n'),
1297
('tree1/b', 'b contents\n'),
1298
('tree1/c', 'c contents\n'),
1299
('tree2/a', 'a contents\n'),
1300
('tree2/b', 'b contents\n'),
1301
('tree2/c', 'c contents\n'),
1303
tree1.add(['a', 'b', 'c'], ['a-id', 'b-id', 'c-id'])
1304
tree2.add(['a', 'c'], ['a-id', 'c-id'])
1306
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1309
self.deleted(tree1, 'b-id'),
1310
self.unversioned(tree2, 'b'),
1312
self.assertEqual(expected,
1313
self.do_iter_changes(tree1, tree2,
1314
want_unversioned=True))
1316
self.deleted(tree1, 'b-id'),
1318
self.assertEqual(expected,
1319
self.do_iter_changes(tree1, tree2,
1320
want_unversioned=False))