78
class TestCaseWithInterBranch(TestCaseWithBzrDir):
82
class TestCaseWithInterBranch(TestCaseWithTransport):
81
85
super(TestCaseWithInterBranch, self).setUp()
83
def make_branch(self, relpath, format=None):
84
repo = self.make_repository(relpath, format=format)
85
return repo.bzrdir.create_branch()
87
def make_bzrdir(self, relpath, format=None):
89
url = self.get_url(relpath)
90
segments = url.split('/')
91
if segments and segments[-1] not in ('', '.'):
92
parent = '/'.join(segments[:-1])
93
t = get_transport(parent)
99
format = self.branch_format_from._matchingbzrdir
100
return format.initialize(url)
101
except UninitializableFormat:
102
raise TestSkipped("Format %s is not initializable." % format)
104
def make_repository(self, relpath, format=None):
105
made_control = self.make_bzrdir(relpath, format=format)
106
return made_control.create_repository()
108
def make_to_bzrdir(self, relpath):
109
return self.make_bzrdir(relpath,
110
self.branch_format_to._matchingbzrdir)
87
def make_from_branch(self, relpath):
88
repo = self.make_repository(relpath)
89
return self.branch_format_from.initialize(repo.bzrdir)
91
def make_from_branch_and_memory_tree(self, relpath):
92
"""Create a branch on the default transport and a MemoryTree for it."""
93
b = self.make_from_branch(relpath)
94
return memorytree.MemoryTree.create_on_branch(b)
96
def make_from_branch_and_tree(self, relpath):
97
"""Create a branch on the default transport and a working tree for it."""
98
b = self.make_from_branch(relpath)
99
return b.bzrdir.create_workingtree()
112
101
def make_to_branch(self, relpath):
113
made_control = self.make_to_bzrdir(relpath)
114
return self.branch_format_to.initialize(made_control)
102
repo = self.make_repository(relpath)
103
return self.branch_format_to.initialize(repo.bzrdir)
105
def make_to_branch_and_memory_tree(self, relpath):
106
"""Create a branch on the default transport and a MemoryTree for it."""
107
b = self.make_to_branch(relpath)
108
return memorytree.MemoryTree.create_on_branch(b)
110
def sprout_to(self, origdir, to_url):
111
"""Sprout a bzrdir, using to_format for the new bzrdir."""
112
newbranch = self.make_to_branch(to_url)
113
origdir.open_branch().copy_content_into(newbranch)
114
newbranch.bzrdir.create_workingtree()
115
return newbranch.bzrdir
117
118
def load_tests(standard_tests, module, loader):