214
215
return self.workingtree_to_test_tree(tree)
217
def get_tree_with_utf8(self, tree):
218
"""Generate a tree with a utf8 revision and unicode paths."""
219
self._create_tree_with_utf8(tree)
220
return self.workingtree_to_test_tree(tree)
222
def _create_tree_with_utf8(self, tree):
223
"""Generate a tree with a utf8 revision and unicode paths."""
229
# bzr itself does not create unicode file ids, but we want them for
231
file_ids = [u'TREE_ROOT',
232
u'f\xf6-id'.encode('utf8'),
233
u'b\xe5r-id'.encode('utf8'),
234
u'b\xe1z-id'.encode('utf8'),
237
self.build_tree(paths[1:])
239
raise tests.TestSkipped('filesystem does not support unicode.')
240
if tree.path2id('') is None:
241
# Some trees do not have a root yet.
242
tree.add(paths, file_ids)
244
# Some trees will already have a root
245
tree.set_root_id(file_ids[0])
246
tree.add(paths[1:], file_ids[1:])
248
tree.commit(u'in\xedtial', rev_id=u'r\xe9v-1'.encode('utf8'))
249
except errors.NonAsciiRevisionId:
250
raise tests.TestSkipped('non-ascii revision ids not supported')
252
def get_tree_with_merged_utf8(self, tree):
253
"""Generate a tree with utf8 ancestors."""
254
self._create_tree_with_utf8(tree)
255
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
256
self.build_tree([u'tree2/b\xe5r/z\xf7z'])
257
tree2.add([u'b\xe5r/z\xf7z'], [u'z\xf7z-id'.encode('utf8')])
258
tree2.commit(u'to m\xe9rge', rev_id=u'r\xe9v-2'.encode('utf8'))
260
tree.merge_from_branch(tree2.branch)
261
tree.commit(u'm\xe9rge', rev_id=u'r\xe9v-3'.encode('utf8'))
262
return self.workingtree_to_test_tree(tree)
217
265
class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
218
266
"""Generate test suites for each Tree implementation in bzrlib.