75
78
# convert that to the final shape
76
79
return self.workingtree_to_test_tree(tree)
81
def _make_abc_tree(self, tree):
82
"""setup an abc content tree."""
83
files = ['a', 'b/', 'b/c']
84
self.build_tree(files, transport=tree.bzrdir.root_transport)
85
tree.add(files, ['a-id', 'b-id', 'c-id'])
87
def get_tree_no_parents_abc_content(self):
88
"""return a test tree with a, b/, b/c contents."""
89
tree = self.make_branch_and_tree('.')
90
self._make_abc_tree(tree)
91
return self.workingtree_to_test_tree(tree)
93
def get_tree_no_parents_abc_content_2(self):
94
"""return a test tree with a, b/, b/c contents.
96
This variation changes the content of 'a' to foobar\n.
98
tree = self.make_branch_and_tree('.')
99
self._make_abc_tree(tree)
100
f = open(tree.basedir + '/a', 'wb')
105
return self.workingtree_to_test_tree(tree)
107
def get_tree_no_parents_abc_content_3(self):
108
"""return a test tree with a, b/, b/c contents.
110
This variation changes the executable flag of b/c to True.
112
tree = self.make_branch_and_tree('.')
113
self._make_abc_tree(tree)
114
tt = transform.TreeTransform(tree)
115
trans_id = tt.trans_id_tree_path('b/c')
116
tt.set_executability(True, trans_id)
118
return self.workingtree_to_test_tree(tree)
120
def get_tree_no_parents_abc_content_4(self):
121
"""return a test tree with d, b/, b/c contents.
123
This variation renames a to d.
125
tree = self.make_branch_and_tree('.')
126
self._make_abc_tree(tree)
127
tree.rename_one('a', 'd')
128
return self.workingtree_to_test_tree(tree)
130
def get_tree_no_parents_abc_content_5(self):
131
"""return a test tree with d, b/, b/c contents.
133
This variation renames a to d and alters its content to 'bar\n'.
135
tree = self.make_branch_and_tree('.')
136
self._make_abc_tree(tree)
137
tree.rename_one('a', 'd')
138
f = open(tree.basedir + '/d', 'wb')
143
return self.workingtree_to_test_tree(tree)
145
def get_tree_no_parents_abc_content_6(self):
146
"""return a test tree with a, b/, e contents.
148
This variation renames b/c to e, and makes it executable.
150
tree = self.make_branch_and_tree('.')
151
self._make_abc_tree(tree)
152
tt = transform.TreeTransform(tree)
153
trans_id = tt.trans_id_tree_path('b/c')
154
parent_trans_id = tt.trans_id_tree_path('')
155
tt.adjust_path('e', parent_trans_id, trans_id)
156
tt.set_executability(True, trans_id)
158
return self.workingtree_to_test_tree(tree)
79
161
class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
80
162
"""Generate test suites for each Tree implementation in bzrlib.