63
63
def test_branch_to_branch(self):
64
64
branch = self.make_branch('branch')
65
self.assertRaises(errors.AlreadyBranch,
65
self.assertRaises(reconfigure.AlreadyBranch,
66
66
reconfigure.Reconfigure.to_branch, branch.controldir)
68
68
def test_repo_to_branch(self):
143
143
def test_tree_to_tree(self):
144
144
tree = self.make_branch_and_tree('tree')
145
self.assertRaises(errors.AlreadyTree, reconfigure.Reconfigure.to_tree,
145
self.assertRaises(reconfigure.AlreadyTree,
146
reconfigure.Reconfigure.to_tree, tree.controldir)
148
148
def test_select_bind_location(self):
149
149
branch = self.make_branch('branch')
150
150
reconfiguration = reconfigure.Reconfigure(branch.controldir)
151
self.assertRaises(errors.NoBindLocation,
151
self.assertRaises(reconfigure.NoBindLocation,
152
152
reconfiguration._select_bind_location)
153
153
branch.set_parent('http://parent')
154
154
reconfiguration = reconfigure.Reconfigure(branch.controldir)
190
190
tree = self.make_branch_and_tree('tree')
191
191
reconfiguration = reconfigure.Reconfigure.to_checkout(tree.controldir)
192
self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
192
self.assertRaises(reconfigure.NoBindLocation, reconfiguration.apply)
193
193
# setting a parent allows it to become a checkout
194
194
tree.branch.set_parent(parent.base)
195
195
reconfiguration = reconfigure.Reconfigure.to_checkout(tree.controldir)
208
208
tree = self.make_branch_and_tree('tree')
209
209
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
211
self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
211
self.assertRaises(reconfigure.NoBindLocation, reconfiguration.apply)
212
212
# setting a parent allows it to become a checkout
213
213
tree.branch.set_parent(parent.base)
214
214
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
223
223
def test_checkout_to_checkout(self):
224
224
parent = self.make_branch('parent')
225
225
checkout = parent.create_checkout('checkout')
226
self.assertRaises(errors.AlreadyCheckout,
226
self.assertRaises(reconfigure.AlreadyCheckout,
227
227
reconfigure.Reconfigure.to_checkout, checkout.controldir)
229
229
def make_unsynced_checkout(self):
237
237
def test_unsynced_checkout_to_lightweight(self):
238
238
checkout, parent, reconfiguration = self.make_unsynced_checkout()
239
self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
239
self.assertRaises(reconfigure.UnsyncedBranches, reconfiguration.apply)
241
241
def test_synced_checkout_to_lightweight(self):
242
242
checkout, parent, reconfiguration = self.make_unsynced_checkout()
294
294
def test_lightweight_checkout_to_lightweight_checkout(self):
295
295
parent = self.make_branch('parent')
296
296
checkout = parent.create_checkout('checkout', lightweight=True)
297
self.assertRaises(errors.AlreadyLightweightCheckout,
297
self.assertRaises(reconfigure.AlreadyLightweightCheckout,
298
298
reconfigure.Reconfigure.to_lightweight_checkout,
299
299
checkout.controldir)
308
308
repo = self.make_repository('repo', shared=True)
309
309
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
311
self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
311
self.assertRaises(reconfigure.NoBindLocation, reconfiguration.apply)
312
312
branch = self.make_branch('branch')
313
313
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
314
314
repo.controldir, 'branch')
365
365
def test_use_shared_to_use_shared(self):
366
366
tree = self.make_repository_tree()
367
self.assertRaises(errors.AlreadyUsingShared,
367
self.assertRaises(reconfigure.AlreadyUsingShared,
368
368
reconfigure.Reconfigure.to_use_shared, tree.controldir)
370
370
def test_use_shared_to_standalone(self):
390
390
def test_standalone_to_standalone(self):
391
391
tree = self.make_branch_and_tree('tree')
392
self.assertRaises(errors.AlreadyStandalone,
392
self.assertRaises(reconfigure.AlreadyStandalone,
393
393
reconfigure.Reconfigure.to_standalone, tree.controldir)
395
395
def make_unsynced_branch_reconfiguration(self):
402
402
def test_unsynced_branch_to_lightweight_checkout_unforced(self):
403
403
reconfiguration = self.make_unsynced_branch_reconfiguration()
404
self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
404
self.assertRaises(reconfigure.UnsyncedBranches, reconfiguration.apply)
406
406
def test_unsynced_branch_to_lightweight_checkout_forced(self):
407
407
reconfiguration = self.make_unsynced_branch_reconfiguration()
429
429
def test_make_with_trees_already_with_trees(self):
430
430
repo = self.make_repository_with_without_trees(True)
431
e = self.assertRaises(errors.AlreadyWithTrees,
431
e = self.assertRaises(reconfiure.AlreadyWithTrees,
432
432
reconfigure.Reconfigure.set_repository_trees, repo.controldir, True)
433
433
self.assertContainsRe(str(e),
434
434
r"Shared repository '.*' already creates working trees.")
436
436
def test_make_without_trees_already_no_trees(self):
437
437
repo = self.make_repository_with_without_trees(False)
438
e = self.assertRaises(errors.AlreadyWithNoTrees,
438
e = self.assertRaises(reconfigure.AlreadyWithNoTrees,
439
439
reconfigure.Reconfigure.set_repository_trees, repo.controldir, False)
440
440
self.assertContainsRe(str(e),
441
441
r"Shared repository '.*' already doesn't create working trees.")
443
443
def test_repository_tree_reconfiguration_not_supported(self):
444
444
tree = self.make_branch_and_tree('tree')
445
e = self.assertRaises(errors.ReconfigurationNotSupported,
445
e = self.assertRaises(reconfigure.ReconfigurationNotSupported,
446
446
reconfigure.Reconfigure.set_repository_trees, tree.controldir, None)
447
447
self.assertContainsRe(str(e),
448
448
r"Requested reconfiguration of '.*' is not supported.")