287
287
self.assertRaises(errors.NoRepositoryPresent,
288
288
repository.Repository.open, 'repo')
290
def test_standalone_to_sharing(self):
290
def test_standalone_to_use_shared(self):
291
291
self.build_tree(['root/'])
292
292
tree = self.make_branch_and_tree('root/tree')
293
293
tree.commit('Hello', rev_id='hello-id')
294
294
repo = self.make_repository('root', shared=True)
295
reconfiguration = reconfigure.Reconfigure.to_sharing(tree.bzrdir)
295
reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.bzrdir)
296
296
reconfiguration.apply()
297
297
tree = workingtree.WorkingTree.open('root/tree')
298
298
self.assertTrue(repo.has_same_location(tree.branch.repository))
299
299
self.assertEqual('Hello', repo.get_revision('hello-id').message)
301
def make_sharing_tree(self):
301
def make_repository_tree(self):
302
302
self.build_tree(['root/'])
303
303
repo = self.make_repository('root', shared=True)
304
304
tree = self.make_branch_and_tree('root/tree')
305
reconfigure.Reconfigure.to_sharing(tree.bzrdir).apply()
305
reconfigure.Reconfigure.to_use_shared(tree.bzrdir).apply()
306
306
return workingtree.WorkingTree.open('root/tree')
308
def test_sharing_to_sharing(self):
309
tree = self.make_sharing_tree()
310
self.assertRaises(errors.AlreadySharing,
311
reconfigure.Reconfigure.to_sharing, tree.bzrdir)
308
def test_use_shared_to_use_shared(self):
309
tree = self.make_repository_tree()
310
self.assertRaises(errors.AlreadyUsingShared,
311
reconfigure.Reconfigure.to_use_shared, tree.bzrdir)
313
def test_sharing_to_standalone(self):
314
tree = self.make_sharing_tree()
313
def test_use_shared_to_standalone(self):
314
tree = self.make_repository_tree()
315
315
tree.commit('Hello', rev_id='hello-id')
316
316
reconfigure.Reconfigure.to_standalone(tree.bzrdir).apply()
317
317
tree = workingtree.WorkingTree.open('root/tree')