~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
377
377
    def test_unsynced_branch_to_lightweight_checkout_forced(self):
378
378
        reconfiguration = self.make_unsynced_branch_reconfiguration()
379
379
        reconfiguration.apply(force=True)
 
380
 
 
381
    def make_repository_with_without_trees(self, with_trees):
 
382
        repo = self.make_repository('repo', shared=True)
 
383
        repo.set_make_working_trees(with_trees)
 
384
        return repo
 
385
 
 
386
    def test_make_with_trees(self):
 
387
        repo = self.make_repository_with_without_trees(False)
 
388
        reconfiguration = reconfigure.Reconfigure.set_repository_trees(
 
389
            repo.bzrdir, True)
 
390
        reconfiguration.apply()
 
391
        self.assertIs(True, repo.make_working_trees())
 
392
 
 
393
    def test_make_without_trees(self):
 
394
        repo = self.make_repository_with_without_trees(True)
 
395
        reconfiguration = reconfigure.Reconfigure.set_repository_trees(
 
396
            repo.bzrdir, False)
 
397
        reconfiguration.apply()
 
398
        self.assertIs(False, repo.make_working_trees())
 
399
 
 
400
    def test_make_with_trees_already_with_trees(self):
 
401
        repo = self.make_repository_with_without_trees(True)
 
402
        e = self.assertRaises(errors.AlreadyWithTrees,
 
403
           reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, True)
 
404
        self.assertContainsRe(str(e),
 
405
            r"Shared repository '.*' already creates working trees.")
 
406
 
 
407
    def test_make_without_trees_already_no_trees(self):
 
408
        repo = self.make_repository_with_without_trees(False)
 
409
        e = self.assertRaises(errors.AlreadyWithNoTrees,
 
410
            reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, False)
 
411
        self.assertContainsRe(str(e),
 
412
            r"Shared repository '.*' already doesn't create working trees.")
 
413
 
 
414
    def test_repository_tree_reconfiguration_not_supported(self):
 
415
        tree = self.make_branch_and_tree('tree')
 
416
        e = self.assertRaises(errors.ReconfigurationNotSupported,
 
417
            reconfigure.Reconfigure.set_repository_trees, tree.bzrdir, None)
 
418
        self.assertContainsRe(str(e),
 
419
            r"Requested reconfiguration of '.*' is not supported.")