~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/intertree_implementations/test_compare.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-16 21:05:46 UTC
  • mfrom: (2408.1.8 selftest.win32)
  • Revision ID: pqm@pqm.ubuntu.com-20070416210546-4ib7pt7wkkk71zzj
(bialix,r=john) win32-related selftest improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
321
321
        tree2 = self.make_to_branch_and_tree('tree2')
322
322
        tree2.set_root_id(tree1.get_root_id())
323
323
        self.build_tree(['tree2/file', 'tree2/dir/'])
324
 
        # try:
325
 
        os.symlink('target', 'tree2/link')
326
 
        links_supported = True
327
 
        # except ???:
328
 
        #   links_supported = False
 
324
        if has_symlinks():
 
325
            os.symlink('target', 'tree2/link')
 
326
            links_supported = True
 
327
        else:
 
328
            links_supported = False
329
329
        tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
330
330
        d = self.intertree_class(tree1, tree2).compare(want_unversioned=True)
331
331
        self.assertEqual([], d.added)
333
333
        self.assertEqual([], d.removed)
334
334
        self.assertEqual([], d.renamed)
335
335
        self.assertEqual([], d.unchanged)
336
 
        self.assertEqual([(u'dir', None, 'directory'), (u'file', None, 'file'),
337
 
            (u'link', None, 'symlink')], d.unversioned)
 
336
        expected_unversioned = [(u'dir', None, 'directory'),
 
337
                                (u'file', None, 'file')]
 
338
        if links_supported:
 
339
            expected_unversioned.append((u'link', None, 'symlink'))
 
340
        self.assertEqual(expected_unversioned, d.unversioned)
338
341
 
339
342
 
340
343
class TestIterChanges(TestCaseWithTwoTrees):
776
779
        tree2 = self.make_to_branch_and_tree('tree2')
777
780
        tree2.set_root_id(tree1.get_root_id())
778
781
        self.build_tree(['tree2/file', 'tree2/dir/'])
779
 
        # try:
780
 
        os.symlink('target', 'tree2/link')
781
 
        links_supported = True
782
 
        # except ???:
783
 
        #   links_supported = False
 
782
        if has_symlinks():
 
783
            os.symlink('target', 'tree2/link')
 
784
            links_supported = True
 
785
        else:
 
786
            links_supported = False
784
787
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
785
788
        expected = [
786
789
            self.unversioned(tree2, 'file'),
796
799
        tree1 = self.make_branch_and_tree('tree1')
797
800
        tree2 = self.make_to_branch_and_tree('tree2')
798
801
        self.build_tree(['tree2/file', 'tree2/dir/'])
799
 
        # try:
800
 
        os.symlink('target', 'tree2/link')
801
 
        links_supported = True
802
 
        # except ???:
803
 
        #   links_supported = False
 
802
        if has_symlinks():
 
803
            os.symlink('target', 'tree2/link')
 
804
            links_supported = True
 
805
        else:
 
806
            links_supported = False
804
807
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
805
808
        expected = [
806
809
            self.unversioned(tree2, 'file'),
829
832
        self.build_tree(['tree2/file', 'tree2/dir/',
830
833
            'tree1/file', 'tree2/movedfile',
831
834
            'tree1/dir/', 'tree2/moveddir/'])
832
 
        # try:
833
 
        os.symlink('target', 'tree1/link')
834
 
        os.symlink('target', 'tree2/link')
835
 
        os.symlink('target', 'tree2/movedlink')
836
 
        links_supported = True
837
 
        # except ???:
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'])
 
835
        if has_symlinks():
 
836
            os.symlink('target', 'tree1/link')
 
837
            os.symlink('target', 'tree2/link')
 
838
            os.symlink('target', 'tree2/movedlink')
 
839
            links_supported = True
 
840
        else:
 
841
            links_supported = False
 
842
        tree1.add(['file', 'dir'], ['file-id', 'dir-id'])
 
843
        tree2.add(['movedfile', 'moveddir'], ['file-id', 'dir-id'])
 
844
        if links_supported:
 
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('')
844
849
        expected = [