50
51
def test_repo_to_branch(self):
51
52
repo = self.make_repository('repo')
52
self.assertRaises(errors.ReconfigurationNotSupported,
53
reconfigure.Reconfigure.to_branch, repo.bzrdir)
53
reconfiguration = reconfigure.Reconfigure.to_branch(repo.bzrdir)
54
reconfiguration.apply()
55
56
def test_checkout_to_branch(self):
56
57
branch = self.make_branch('branch')
147
148
reconfiguration.apply()
150
def test_tree_to_lightweight_checkout(self):
151
# A tree with no related branches and no supplied bind location cannot
153
parent = self.make_branch('parent')
155
tree = self.make_branch_and_tree('tree')
156
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
158
self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
159
# setting a parent allows it to become a checkout
160
tree.branch.set_parent(parent.base)
161
reconfiguration.apply()
162
# supplying a location allows it to become a checkout
163
tree2 = self.make_branch_and_tree('tree2')
164
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
165
tree2.bzrdir, parent.base)
166
reconfiguration.apply()
149
168
def test_checkout_to_checkout(self):
150
169
parent = self.make_branch('parent')
151
170
checkout = parent.create_checkout('checkout')
187
206
self.assertRaises(errors.AlreadyLightweightCheckout,
188
207
reconfigure.Reconfigure.to_lightweight_checkout,
210
def test_repo_to_tree(self):
211
repo = self.make_repository('repo')
212
reconfiguration = reconfigure.Reconfigure.to_tree(repo.bzrdir)
213
reconfiguration.apply()
214
workingtree.WorkingTree.open('repo')
216
def test_shared_repo_to_lightweight_checkout(self):
217
repo = self.make_repository('repo', shared=True)
218
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
220
self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
221
branch = self.make_branch('branch')
222
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
223
repo.bzrdir, 'branch')
224
reconfiguration.apply()
225
workingtree.WorkingTree.open('repo')
226
repository.Repository.open('repo')
228
def test_unshared_repo_to_lightweight_checkout(self):
229
repo = self.make_repository('repo', shared=False)
230
branch = self.make_branch('branch')
231
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
232
repo.bzrdir, 'branch')
233
reconfiguration.apply()
234
workingtree.WorkingTree.open('repo')
235
self.assertRaises(errors.NoRepositoryPresent,
236
repository.Repository.open, 'repo')