/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_reconfigure.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
    def test_checkout_to_branch(self):
74
74
        branch = self.make_branch('branch')
75
75
        checkout = branch.create_checkout('checkout')
76
 
        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.controldir)
 
76
        reconfiguration = reconfigure.Reconfigure.to_branch(
 
77
            checkout.controldir)
77
78
        reconfiguration.apply()
78
79
        reconfigured = controldir.ControlDir.open('checkout').open_branch()
79
80
        self.assertIs(None, reconfigured.get_bound_location())
82
83
        branch = self.make_branch('branch')
83
84
        checkout = branch.create_checkout('checkout', lightweight=True)
84
85
        checkout.commit('first commit', rev_id=b'rev1')
85
 
        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.controldir)
 
86
        reconfiguration = reconfigure.Reconfigure.to_branch(
 
87
            checkout.controldir)
86
88
        return reconfiguration, checkout
87
89
 
88
90
    def test_lightweight_checkout_to_branch(self):
107
109
    def prepare_lightweight_checkout_to_checkout(self):
108
110
        branch = self.make_branch('branch')
109
111
        checkout = branch.create_checkout('checkout', lightweight=True)
110
 
        reconfiguration = reconfigure.Reconfigure.to_checkout(checkout.controldir)
 
112
        reconfiguration = reconfigure.Reconfigure.to_checkout(
 
113
            checkout.controldir)
111
114
        return reconfiguration, checkout
112
115
 
113
116
    def test_lightweight_checkout_to_checkout(self):
136
139
 
137
140
    def test_branch_to_tree(self):
138
141
        branch = self.make_branch('branch')
139
 
        reconfiguration=reconfigure.Reconfigure.to_tree(branch.controldir)
 
142
        reconfiguration = reconfigure.Reconfigure.to_tree(branch.controldir)
140
143
        reconfiguration.apply()
141
144
        branch.controldir.open_workingtree()
142
145
 
309
312
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
310
313
            repo.controldir)
311
314
        self.assertRaises(reconfigure.NoBindLocation, reconfiguration.apply)
312
 
        branch = self.make_branch('branch')
 
315
        self.make_branch('branch')
313
316
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
314
317
            repo.controldir, 'branch')
315
318
        reconfiguration.apply()
318
321
 
319
322
    def test_unshared_repo_to_lightweight_checkout(self):
320
323
        repo = self.make_repository('repo', shared=False)
321
 
        branch = self.make_branch('branch')
 
324
        self.make_branch('branch')
322
325
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
323
326
            repo.controldir, 'branch')
324
327
        reconfiguration.apply()
331
334
        tree = self.make_branch_and_tree('root/tree')
332
335
        tree.commit('Hello', rev_id=b'hello-id')
333
336
        repo = self.make_repository('root', shared=True)
334
 
        reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.controldir)
 
337
        reconfiguration = reconfigure.Reconfigure.to_use_shared(
 
338
            tree.controldir)
335
339
        reconfiguration.apply()
336
340
        tree = workingtree.WorkingTree.open('root/tree')
337
341
        self.assertTrue(repo.has_same_location(tree.branch.repository))
349
353
        self.add_dead_head(tree)
350
354
        tree.commit('Hello', rev_id=b'hello-id')
351
355
        repo = self.make_repository('root', shared=True)
352
 
        reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.controldir)
 
356
        reconfiguration = reconfigure.Reconfigure.to_use_shared(
 
357
            tree.controldir)
353
358
        reconfiguration.apply()
354
359
        tree = workingtree.WorkingTree.open('root/tree')
355
360
        message = repo.get_revision(b'dead-head-id').message
357
362
 
358
363
    def make_repository_tree(self):
359
364
        self.build_tree(['root/'])
360
 
        repo = self.make_repository('root', shared=True)
 
365
        self.make_repository('root', shared=True)
361
366
        tree = self.make_branch_and_tree('root/tree')
362
367
        reconfigure.Reconfigure.to_use_shared(tree.controldir).apply()
363
368
        return workingtree.WorkingTree.open('root/tree')
429
434
    def test_make_with_trees_already_with_trees(self):
430
435
        repo = self.make_repository_with_without_trees(True)
431
436
        e = self.assertRaises(reconfigure.AlreadyWithTrees,
432
 
           reconfigure.Reconfigure.set_repository_trees, repo.controldir, True)
 
437
                              reconfigure.Reconfigure.set_repository_trees, repo.controldir, True)
433
438
        self.assertContainsRe(str(e),
434
 
            r"Shared repository '.*' already creates working trees.")
 
439
                              r"Shared repository '.*' already creates working trees.")
435
440
 
436
441
    def test_make_without_trees_already_no_trees(self):
437
442
        repo = self.make_repository_with_without_trees(False)
438
 
        e = self.assertRaises(reconfigure.AlreadyWithNoTrees,
439
 
            reconfigure.Reconfigure.set_repository_trees, repo.controldir, False)
440
 
        self.assertContainsRe(str(e),
 
443
        e = self.assertRaises(
 
444
            reconfigure.AlreadyWithNoTrees,
 
445
            reconfigure.Reconfigure.set_repository_trees, repo.controldir,
 
446
            False)
 
447
        self.assertContainsRe(
 
448
            str(e),
441
449
            r"Shared repository '.*' already doesn't create working trees.")
442
450
 
443
451
    def test_repository_tree_reconfiguration_not_supported(self):
444
452
        tree = self.make_branch_and_tree('tree')
445
 
        e = self.assertRaises(reconfigure.ReconfigurationNotSupported,
446
 
            reconfigure.Reconfigure.set_repository_trees, tree.controldir, None)
447
 
        self.assertContainsRe(str(e),
448
 
            r"Requested reconfiguration of '.*' is not supported.")
 
453
        e = self.assertRaises(
 
454
            reconfigure.ReconfigurationNotSupported,
 
455
            reconfigure.Reconfigure.set_repository_trees, tree.controldir,
 
456
            None)
 
457
        self.assertContainsRe(
 
458
            str(e), r"Requested reconfiguration of '.*' is not supported.")
449
459
 
450
460
    def test_lightweight_checkout_to_tree_preserves_reference_locations(self):
451
461
        format = controldir.format_registry.make_controldir('1.9')