1
# Copyright (C) 2006 Canonical Ltd
1
# Copyright (C) 2006, 2007 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
165
166
return self._convert_tree(tree, converter)
168
def get_tree_with_utf8(self, tree):
169
"""Generate a tree with a utf8 revision and unicode paths."""
170
self._create_tree_with_utf8(tree)
171
return self.workingtree_to_test_tree(tree)
173
def _create_tree_with_utf8(self, tree):
174
"""Generate a tree with a utf8 revision and unicode paths."""
180
# bzr itself does not create unicode file ids, but we want them for
182
file_ids = [u'TREE_ROOT',
188
self.build_tree(paths[1:])
190
raise tests.TestSkipped('filesystem does not support unicode.')
191
tree.add(paths, file_ids)
193
tree.commit(u'in\xedtial', rev_id=u'r\xe9v-1'.encode('utf8'))
194
except errors.NonAsciiRevisionId:
195
raise tests.TestSkipped('non-ascii revision ids not supported')
197
def get_tree_with_merged_utf8(self, tree):
198
"""Generate a tree with utf8 ancestors."""
199
self._create_tree_with_utf8(tree)
200
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
201
self.build_tree([u'tree2/b\xe5r/z\xf7z'])
202
tree2.add([u'b\xe5r/z\xf7z'], [u'z\xf7z-id'])
203
tree2.commit(u'to m\xe9rge', rev_id=u'r\xe9v-2'.encode('utf8'))
205
tree.merge_from_branch(tree2.branch)
206
tree.commit(u'm\xe9rge', rev_id=u'r\xe9v-3'.encode('utf8'))
207
return self.workingtree_to_test_tree(tree)
168
210
class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
169
211
"""Generate test suites for each Tree implementation in bzrlib.