/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

Merge divergence with bb-core.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import shutil
21
21
 
22
 
from bzrlib import errors, tests, workingtree_4
 
22
from bzrlib import (
 
23
    errors,
 
24
    revisiontree,
 
25
    tests,
 
26
    workingtree_4,
 
27
    )
23
28
from bzrlib.osutils import file_kind, has_symlinks
24
29
from bzrlib.tests import TestNotApplicable
25
30
from bzrlib.tests.intertree_implementations import TestCaseWithTwoTrees
507
512
            # file status. This is normal (e.g. InterDirstateTree falls back
508
513
            # to InterTree if the basis is not a DirstateRevisionTree, and
509
514
            # revision trees cannot have missing files. 
510
 
            raise TestNotApplicable()
 
515
            raise TestNotApplicable('cannot represent missing files')
 
516
 
 
517
    def not_applicable_if_cannot_represent_unversioned(self, tree):
 
518
        if isinstance(tree, revisiontree.RevisionTree):
 
519
            # The locked test trees conversion could not preserve the
 
520
            # unversioned file status. This is normal (e.g. InterDirstateTree
 
521
            # falls back to InterTree if the basis is not a
 
522
            # DirstateRevisionTree, and revision trees cannot have unversioned
 
523
            # files.
 
524
            raise TestNotApplicable('cannot represent unversioned files')
511
525
 
512
526
    def test_empty_to_abc_content(self):
513
527
        tree1 = self.make_branch_and_tree('1')
849
863
        else:
850
864
            links_supported = False
851
865
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
866
        self.not_applicable_if_cannot_represent_unversioned(tree2)
852
867
        expected = [
853
868
            self.unversioned(tree2, 'file'),
854
869
            self.unversioned(tree2, 'dir'),
869
884
        else:
870
885
            links_supported = False
871
886
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
887
        self.not_applicable_if_cannot_represent_unversioned(tree2)
872
888
        expected = [
873
889
            self.unversioned(tree2, 'file'),
874
890
            self.unversioned(tree2, 'dir'),
909
925
            tree1.add(['link'], ['link-id'])
910
926
            tree2.add(['movedlink'], ['link-id'])
911
927
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
928
        self.not_applicable_if_cannot_represent_unversioned(tree2)
912
929
        root_id = tree1.path2id('')
913
930
        expected = [
914
931
            self.renamed(tree1, tree2, 'dir-id', False),
958
975
                  ['a-id', 'b-id', 'c-id', 'd-id', 'a-c-id', 'e-id'])
959
976
 
960
977
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
978
        self.not_applicable_if_cannot_represent_unversioned(tree2)
961
979
 
962
980
        self.assertEqual([], self.do_iter_changes(tree1, tree2,
963
981
                                                  want_unversioned=True))
982
1000
        tree2.set_root_id(tree1.get_root_id())
983
1001
        self.build_tree(['tree2/dir/', 'tree2/dir/file'])
984
1002
        tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
 
1003
        self.not_applicable_if_cannot_represent_unversioned(tree2)
985
1004
        expected = [
986
1005
            self.unversioned(tree2, 'dir'),
987
1006
            ]
1031
1050
    def test_versioned_symlinks(self):
1032
1051
        self.requireFeature(tests.SymlinkFeature)
1033
1052
        tree1, tree2 = self.make_trees_with_symlinks()
 
1053
        self.not_applicable_if_cannot_represent_unversioned(tree2)
1034
1054
        root_id = tree1.path2id('')
1035
1055
        expected = [
1036
1056
            self.unchanged(tree1, tree1.path2id('')),
1290
1310
        tree2.add([u'\u03b1'], [a_id])
1291
1311
 
1292
1312
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
1313
        self.not_applicable_if_cannot_represent_unversioned(tree2)
1293
1314
 
1294
1315
        expected = sorted([
1295
1316
            self.unversioned(tree2, u'\u03b1/unknown_dir'),
1340
1361
        self.build_tree(['tree2/a/file', 'tree2/a/dir/', 'tree2/a/dir/subfile'])
1341
1362
 
1342
1363
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
1364
        self.not_applicable_if_cannot_represent_unversioned(tree2)
1343
1365
 
1344
1366
        expected = sorted([
1345
1367
            self.unversioned(tree2, u'a/file'),
1407
1429
        tree2.add(['a', 'c'], ['a-id', 'c-id'])
1408
1430
 
1409
1431
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
1432
        self.not_applicable_if_cannot_represent_unversioned(tree2)
1410
1433
 
1411
1434
        expected = sorted([
1412
1435
            self.deleted(tree1, 'b-id'),