609
620
(False, False)), self.unchanged(tree1, 'c-id')]),
610
621
self.do_iter_changes(tree1, tree2, include_unchanged=True))
612
def _todo_test_unversioned_paths_in_tree(self):
623
def test_default_ignores_unversioned_files(self):
613
624
tree1 = self.make_branch_and_tree('tree1')
614
625
tree2 = self.make_to_branch_and_tree('tree2')
615
self.build_tree(['tree2/file', 'tree2/dir/'])
617
os.symlink('target', 'tree2/link')
618
links_supported = True
620
# links_supported = False
626
self.build_tree(['tree1/a', 'tree1/c',
627
'tree2/a', 'tree2/b', 'tree2/c'])
628
tree1.add(['a', 'c'], ['a-id', 'c-id'])
629
tree2.add(['a', 'c'], ['a-id', 'c-id'])
621
631
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
622
root_id = tree1.path2id('')
623
632
tree1.lock_read()
624
633
self.addCleanup(tree1.unlock)
625
634
tree2.lock_read()
626
635
self.addCleanup(tree2.unlock)
628
self.unversioned(tree2, 'file'),
629
self.unversioned(tree2, 'dir'),
632
expected.append(self.unversioned(tree2, 'link'))
633
expected = sorted(expected)
637
# We should ignore the fact that 'b' exists in tree-2
638
# because the want_unversioned parameter was not given.
640
self.content_changed(tree2, 'a-id'),
641
self.content_changed(tree2, 'c-id'),
634
643
self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
636
def _todo_test_unversioned_paths_in_tree_specific_files(self):
637
tree1 = self.make_branch_and_tree('tree1')
638
tree2 = self.make_to_branch_and_tree('tree2')
639
self.build_tree(['tree2/file', 'tree2/dir/'])
641
os.symlink('target', 'tree2/link')
642
links_supported = True
644
# links_supported = False
645
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
646
root_id = tree1.path2id('')
648
self.addCleanup(tree1.unlock)
650
self.addCleanup(tree2.unlock)
652
self.unversioned(tree2, 'file'),
653
self.unversioned(tree2, 'dir'),
655
specific_files=['file', 'dir']
657
expected.append(self.unversioned(tree2, 'link'))
658
specific_files.append('link')
659
expected = sorted(expected)
660
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
661
specific_files=specific_files))
645
def test_unversioned_paths_in_tree(self):
646
tree1 = self.make_branch_and_tree('tree1')
647
tree2 = self.make_to_branch_and_tree('tree2')
648
self.build_tree(['tree2/file', 'tree2/dir/'])
650
os.symlink('target', 'tree2/link')
651
links_supported = True
653
# links_supported = False
654
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
655
root_id = tree1.path2id('')
657
self.addCleanup(tree1.unlock)
659
self.addCleanup(tree2.unlock)
661
self.unversioned(tree2, 'file'),
662
self.unversioned(tree2, 'dir'),
665
expected.append(self.unversioned(tree2, 'link'))
666
expected = sorted(expected)
667
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
668
want_unversioned=True))
670
def test_unversioned_paths_in_tree_specific_files(self):
671
tree1 = self.make_branch_and_tree('tree1')
672
tree2 = self.make_to_branch_and_tree('tree2')
673
self.build_tree(['tree2/file', 'tree2/dir/'])
675
os.symlink('target', 'tree2/link')
676
links_supported = True
678
# links_supported = False
679
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
680
root_id = tree1.path2id('')
682
self.addCleanup(tree1.unlock)
684
self.addCleanup(tree2.unlock)
686
self.unversioned(tree2, 'file'),
687
self.unversioned(tree2, 'dir'),
689
specific_files=['file', 'dir']
691
expected.append(self.unversioned(tree2, 'link'))
692
specific_files.append('link')
693
expected = sorted(expected)
694
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
695
specific_files=specific_files, require_versioned=False,
696
want_unversioned=True))
698
def test_unversioned_paths_in_target_matching_source_old_names(self):
699
# its likely that naive implementations of unversioned file support
700
# will fail if the path was versioned, but is not any more,
701
# due to a rename, not due to unversioning it.
702
# That is, if the old tree has a versioned file 'foo', and
703
# the new tree has the same file but versioned as 'bar', and also
704
# has an unknown file 'foo', we should get back output for
706
tree1 = self.make_branch_and_tree('tree1')
707
tree2 = self.make_to_branch_and_tree('tree2')
708
self.build_tree(['tree2/file', 'tree2/dir/',
709
'tree1/file', 'tree2/movedfile',
710
'tree1/dir/', 'tree2/moveddir/'])
712
os.symlink('target', 'tree1/link')
713
os.symlink('target', 'tree2/link')
714
os.symlink('target', 'tree2/movedlink')
715
links_supported = True
717
# links_supported = False
718
tree1.add(['file', 'dir', 'link'], ['file-id', 'dir-id', 'link-id'])
719
tree2.add(['movedfile', 'moveddir', 'movedlink'],
720
['file-id', 'dir-id', 'link-id'])
721
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
722
root_id = tree1.path2id('')
724
self.addCleanup(tree1.unlock)
726
self.addCleanup(tree2.unlock)
728
self.renamed(tree1, tree2, 'dir-id', False),
729
self.renamed(tree1, tree2, 'file-id', True),
730
self.unversioned(tree2, 'file'),
731
self.unversioned(tree2, 'dir'),
733
specific_files=['file', 'dir']
735
expected.append(self.renamed(tree1, tree2, 'link-id', False))
736
expected.append(self.unversioned(tree2, 'link'))
737
specific_files.append('link')
738
expected = sorted(expected)
739
# run once with, and once without specific files, to catch
740
# potentially different code paths.
741
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
742
require_versioned=False,
743
want_unversioned=True))
744
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
745
specific_files=specific_files, require_versioned=False,
746
want_unversioned=True))
663
748
def make_trees_with_symlinks(self):
664
749
tree1 = self.make_branch_and_tree('tree1')