/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_tree/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
        tt.apply()
278
278
        return self.workingtree_to_test_tree(tree)
279
279
 
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)
284
 
 
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.
292
 
        paths = [u'',
293
 
                 u'fo\N{Euro Sign}o',
294
 
                 u'ba\N{Euro Sign}r/',
295
 
                 u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
296
 
                ]
297
 
        # bzr itself does not create unicode file ids, but we want them for
298
 
        # testing.
299
 
        file_ids = ['TREE_ROOT',
300
 
                    'fo\xe2\x82\xaco-id',
301
 
                    'ba\xe2\x82\xacr-id',
302
 
                    'ba\xe2\x82\xacz-id',
303
 
                   ]
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)
308
 
        else:
309
 
            # Some trees will already have a root
310
 
            tree.set_root_id(file_ids[0])
311
 
            tree.add(paths[1:], file_ids[1:])
312
 
        try:
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')
316
 
 
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'))
325
 
 
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)
329
 
 
330
280
 
331
281
def make_scenarios(transport_server, transport_readonly_server, formats):
332
282
    """Generate test suites for each Tree implementation in breezy.