~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    errors,
30
30
    tests,
31
31
    transform,
 
32
    transport,
32
33
    )
33
34
from bzrlib.tests.per_controldir.test_controldir import TestCaseWithControlDir
34
35
from bzrlib.tests.per_workingtree import (
37
38
    )
38
39
from bzrlib.revisiontree import RevisionTree
39
40
from bzrlib.transform import TransformPreview
 
41
from bzrlib.tests import (
 
42
    features,
 
43
    )
40
44
from bzrlib.workingtree import (
41
 
    WorkingTreeFormat,
42
 
    _legacy_formats,
 
45
    format_registry,
43
46
    )
44
47
from bzrlib.workingtree_4 import (
45
48
    DirStateRevisionTree,
97
100
class TestCaseWithTree(TestCaseWithControlDir):
98
101
 
99
102
    def make_branch_and_tree(self, relpath):
100
 
        made_control = self.make_bzrdir(relpath, format=
101
 
            self.workingtree_format._matchingbzrdir)
 
103
        bzrdir_format = self.workingtree_format.get_controldir_for_branch()
 
104
        made_control = self.make_bzrdir(relpath, format=bzrdir_format)
102
105
        made_control.create_repository()
103
 
        made_control.create_branch()
104
 
        return self.workingtree_format.initialize(made_control)
 
106
        b = made_control.create_branch()
 
107
        if getattr(self, 'repo_is_remote', False):
 
108
            # If the repo is remote, then we just create a local lightweight
 
109
            # checkout
 
110
            # XXX: This duplicates a lot of Branch.create_checkout, but we know
 
111
            #      we want a) lightweight, and b) a specific WT format. We also
 
112
            #      know that nothing should already exist, etc.
 
113
            t = transport.get_transport(relpath)
 
114
            t.ensure_base()
 
115
            wt_dir = bzrdir_format.initialize_on_transport(t)
 
116
            branch_ref = wt_dir.set_branch_reference(b)
 
117
            wt = wt_dir.create_workingtree(None, from_branch=branch_ref)
 
118
        else:
 
119
            wt = self.workingtree_format.initialize(made_control)
 
120
        return wt
105
121
 
106
122
    def workingtree_to_test_tree(self, tree):
107
123
        return self._workingtree_to_test_tree(self, tree)
243
259
        note that the order of the paths and fileids is deliberately
244
260
        mismatched to ensure that the result order is path based.
245
261
        """
246
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
262
        self.requireFeature(features.UnicodeFilenameFeature)
247
263
        tree = self.make_branch_and_tree('.')
248
264
        paths = ['0file',
249
265
            '1top-dir/',
275
291
 
276
292
    def _create_tree_with_utf8(self, tree):
277
293
        """Generate a tree with a utf8 revision and unicode paths."""
278
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
294
        self.requireFeature(features.UnicodeFilenameFeature)
279
295
        # We avoid combining characters in file names here, normalization
280
296
        # checks (as performed by some file systems (OSX) are outside the scope
281
297
        # of these tests).  We use the euro sign \N{Euro Sign} or \u20ac in
333
349
        # for working tree format tests, preserve the tree
334
350
        scenario[1]["_workingtree_to_test_tree"] = return_parameter
335
351
    # add RevisionTree scenario
336
 
    workingtree_format = WorkingTreeFormat._default_format
 
352
    workingtree_format = format_registry.get_default()
337
353
    scenarios.append((RevisionTree.__name__,
338
354
        create_tree_scenario(transport_server, transport_readonly_server,
339
355
        workingtree_format, revision_tree_from_workingtree,)))
375
391
def load_tests(standard_tests, module, loader):
376
392
    per_tree_mod_names = [
377
393
        'annotate_iter',
 
394
        'export',
378
395
        'get_file_mtime',
379
396
        'get_file_with_stat',
380
397
        'get_root_id',
381
398
        'get_symlink_target',
 
399
        'ids',
382
400
        'inv',
383
401
        'iter_search_rules',
 
402
        'is_executable',
384
403
        'list_files',
385
404
        'locking',
386
405
        'path_content_summary',
397
416
        # None here will cause a readonly decorator to be created
398
417
        # by the TestCaseWithTransport.get_readonly_transport method.
399
418
        None,
400
 
        WorkingTreeFormat._formats.values() + _legacy_formats)
 
419
        format_registry._get_all())
401
420
    # add the tests for the sub modules
402
421
    return tests.multiply_tests(submod_tests, scenarios, standard_tests)