44
def return_provided_trees(source, target):
45
"""Return the source and target tree unaltered."""
44
49
class TestCaseWithTwoTrees(TestCaseWithTree):
46
51
def make_to_branch_and_tree(self, relpath):
51
56
made_control.create_branch()
52
57
return self.workingtree_format_to.initialize(made_control)
54
def get_to_tree_no_parents_no_content(self, empty_tree):
55
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_no_content(empty_tree, converter=self.workingtree_to_test_tree_to)
57
def get_to_tree_no_parents_abc_content(self, empty_tree):
58
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content(empty_tree, converter=self.workingtree_to_test_tree_to)
60
def get_to_tree_no_parents_abc_content_2(self, empty_tree):
61
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content_2(empty_tree, converter=self.workingtree_to_test_tree_to)
63
def get_to_tree_no_parents_abc_content_3(self, empty_tree):
64
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content_3(empty_tree, converter=self.workingtree_to_test_tree_to)
66
def get_to_tree_no_parents_abc_content_4(self, empty_tree):
67
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content_4(empty_tree, converter=self.workingtree_to_test_tree_to)
69
def get_to_tree_no_parents_abc_content_5(self, empty_tree):
70
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content_5(empty_tree, converter=self.workingtree_to_test_tree_to)
72
def get_to_tree_no_parents_abc_content_6(self, empty_tree):
73
return super(TestCaseWithTwoTrees, self).get_tree_no_parents_abc_content_6(empty_tree, converter=self.workingtree_to_test_tree_to)
76
60
class InterTreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
77
61
"""Generate test suites for each InterTree implementation in bzrlib."""
80
64
result = TestSuite()
81
65
for (intertree_class,
82
66
workingtree_format,
83
workingtree_to_test_tree,
84
67
workingtree_format_to,
85
workingtree_to_test_tree_to) in self._formats:
68
mutable_trees_to_test_trees) in self._formats:
86
69
new_test = self._clone_test(
88
71
workingtree_format._matchingbzrdir,
89
72
workingtree_format,
90
73
intertree_class.__name__)
91
74
new_test.intertree_class = intertree_class
92
new_test.workingtree_to_test_tree = workingtree_to_test_tree
93
75
new_test.workingtree_format_to = workingtree_format_to
94
new_test.workingtree_to_test_tree_to = workingtree_to_test_tree_to
76
# mutable_trees_to_test_trees takes two trees and converts them to
77
# whatever relationship the optimiser under test requires.
78
new_test.mutable_trees_to_test_trees = mutable_trees_to_test_trees
79
# workingtree_to_test_tree is set to disable changing individual
80
# trees: instead the mutable_trees_to_test_trees helper is used.
81
new_test.workingtree_to_test_tree = return_parameter
95
82
result.addTest(new_test)
109
96
test_intertree_permutations = [
110
97
# test InterTree with two default-format working trees.
111
(InterTree, default_tree_format, return_parameter,
112
default_tree_format, return_parameter)]
98
(InterTree, default_tree_format, default_tree_format,
99
return_provided_trees)]
113
100
for optimiser in InterTree._optimisers:
114
101
test_intertree_permutations.append(
116
optimiser._matching_from_tree_format, optimiser._from_tree_converter,
117
optimiser._matching_to_tree_format, optimiser._to_tree_converter))
103
optimiser._matching_from_tree_format,
104
optimiser._matching_to_tree_format,
105
optimiser._test_mutable_trees_to_test_trees))
118
106
adapter = InterTreeTestProviderAdapter(
119
107
default_transport,
120
108
# None here will cause a readonly decorator to be created