~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

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
45
    format_registry,
42
46
    )
96
100
class TestCaseWithTree(TestCaseWithControlDir):
97
101
 
98
102
    def make_branch_and_tree(self, relpath):
99
 
        made_control = self.make_bzrdir(relpath, format=
100
 
            self.workingtree_format._matchingbzrdir)
 
103
        bzrdir_format = self.workingtree_format.get_controldir_for_branch()
 
104
        made_control = self.make_bzrdir(relpath, format=bzrdir_format)
101
105
        made_control.create_repository()
102
 
        made_control.create_branch()
103
 
        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
104
121
 
105
122
    def workingtree_to_test_tree(self, tree):
106
123
        return self._workingtree_to_test_tree(self, tree)
242
259
        note that the order of the paths and fileids is deliberately
243
260
        mismatched to ensure that the result order is path based.
244
261
        """
245
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
262
        self.requireFeature(features.UnicodeFilenameFeature)
246
263
        tree = self.make_branch_and_tree('.')
247
264
        paths = ['0file',
248
265
            '1top-dir/',
274
291
 
275
292
    def _create_tree_with_utf8(self, tree):
276
293
        """Generate a tree with a utf8 revision and unicode paths."""
277
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
294
        self.requireFeature(features.UnicodeFilenameFeature)
278
295
        # We avoid combining characters in file names here, normalization
279
296
        # checks (as performed by some file systems (OSX) are outside the scope
280
297
        # of these tests).  We use the euro sign \N{Euro Sign} or \u20ac in
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',
384
402
        'is_executable',