20
20
"""Branch implementation tests for bzr.
22
22
These test the conformance of all the branch variations to the expected API.
23
Specific tests for individual formats are in the `tests/test_branch` file
24
rather than in `tests/per_branch/*.py`.
23
Specific tests for individual formats are in the tests/test_branch file
24
rather than in tests/per_branch/*.py.
27
27
from bzrlib import (
31
from bzrlib.branch import format_registry
32
from bzrlib.remote import RemoteBranchFormat
31
from bzrlib.branch import (BranchFormat,
34
from bzrlib.remote import RemoteBranchFormat, RemoteBzrDirFormat
33
35
from bzrlib.tests import test_server
34
36
from bzrlib.tests.per_controldir.test_controldir import TestCaseWithControlDir
35
37
from bzrlib.transport import memory
68
70
def get_branch(self):
69
71
if self.branch is None:
70
self.branch = self.make_branch('abranch')
72
self.branch = self.make_branch('')
73
def get_default_format(self):
74
format = self.bzrdir_format
75
self.assertEqual(format.get_branch_format(), self.branch_format)
78
75
def make_branch(self, relpath, format=None):
76
if format is not None:
77
return TestCaseWithControlDir.make_branch(self, relpath, format)
78
repo = self.make_repository(relpath)
79
# fixme RBC 20060210 this isnt necessarily a fixable thing,
80
# Skipped is the wrong exception to raise.
80
return super(TestCaseWithBranch, self).make_branch(relpath, format)
82
return self.branch_format.initialize(repo.bzrdir)
81
83
except errors.UninitializableFormat:
82
raise tests.TestNotApplicable('Uninitializable branch format')
84
raise tests.TestSkipped('Uninitializable branch format')
86
def make_branch_builder(self, relpath, format=None):
88
format = self.branch_format._matchingbzrdir
89
return super(TestCaseWithBranch, self).make_branch_builder(
90
relpath, format=format)
92
def make_repository(self, relpath, shared=False, format=None):
93
made_control = self.make_bzrdir(relpath, format=format)
94
return made_control.create_repository(shared=shared)
84
96
def create_tree_with_merge(self):
85
97
"""Create a branch with a simple ancestry.
120
132
# Generate a list of branch formats and their associated bzrdir formats to
122
134
combinations = [(format, format._matchingbzrdir) for format in
123
format_registry._get_all()]
135
BranchFormat.get_formats() + _legacy_formats]
124
136
scenarios = make_scenarios(
125
137
# None here will cause the default vfs transport server to be used.