278
278
return self.workingtree_to_test_tree(tree)
280
def get_tree_with_utf8(self, tree):
281
"""Generate a tree with a utf8 revision and unicode paths."""
282
self._create_tree_with_utf8(tree)
283
return self.workingtree_to_test_tree(tree)
285
def _create_tree_with_utf8(self, tree):
286
"""Generate a tree with a utf8 revision and unicode paths."""
287
self.requireFeature(features.UnicodeFilenameFeature)
288
# We avoid combining characters in file names here, normalization
289
# checks (as performed by some file systems (OSX) are outside the scope
290
# of these tests). We use the euro sign \N{Euro Sign} or \u20ac in
291
# unicode strings or '\xe2\x82\ac' (its utf-8 encoding) in raw strings.
294
u'ba\N{Euro Sign}r/',
295
u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
297
# bzr itself does not create unicode file ids, but we want them for
299
file_ids = ['TREE_ROOT',
300
'fo\xe2\x82\xaco-id',
301
'ba\xe2\x82\xacr-id',
302
'ba\xe2\x82\xacz-id',
304
self.build_tree(paths[1:])
305
if tree.get_root_id() is None:
306
# Some trees do not have a root yet.
307
tree.add(paths, file_ids)
309
# Some trees will already have a root
310
tree.set_root_id(file_ids[0])
311
tree.add(paths[1:], file_ids[1:])
313
tree.commit(u'in\xedtial', rev_id=u'r\xe9v-1'.encode('utf8'))
314
except errors.NonAsciiRevisionId:
315
raise tests.TestSkipped('non-ascii revision ids not supported')
317
def get_tree_with_merged_utf8(self, tree):
318
"""Generate a tree with utf8 ancestors."""
319
self._create_tree_with_utf8(tree)
320
tree2 = tree.controldir.sprout('tree2').open_workingtree()
321
self.build_tree([u'tree2/ba\N{Euro Sign}r/qu\N{Euro Sign}x'])
322
tree2.add([u'ba\N{Euro Sign}r/qu\N{Euro Sign}x'],
323
[u'qu\N{Euro Sign}x-id'.encode('utf-8')])
324
tree2.commit(u'to m\xe9rge', rev_id=u'r\xe9v-2'.encode('utf8'))
326
tree.merge_from_branch(tree2.branch)
327
tree.commit(u'm\xe9rge', rev_id=u'r\xe9v-3'.encode('utf8'))
328
return self.workingtree_to_test_tree(tree)
331
281
def make_scenarios(transport_server, transport_readonly_server, formats):
332
282
"""Generate test suites for each Tree implementation in breezy.