38
39
from bzrlib.revisiontree import RevisionTree
39
40
from bzrlib.transform import TransformPreview
41
from bzrlib.tests import (
40
44
from bzrlib.workingtree import (
44
47
from bzrlib.workingtree_4 import (
45
48
DirStateRevisionTree,
97
100
class TestCaseWithTree(TestCaseWithControlDir):
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
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)
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)
119
wt = self.workingtree_format.initialize(made_control)
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.
246
self.requireFeature(tests.UnicodeFilenameFeature)
262
self.requireFeature(features.UnicodeFilenameFeature)
247
263
tree = self.make_branch_and_tree('.')
248
264
paths = ['0file',
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,)))
397
416
# None here will cause a readonly decorator to be created
398
417
# by the TestCaseWithTransport.get_readonly_transport method.
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)