244
245
# but open_downlevel will work
245
246
self.assertEqual(
246
247
format.open(dir),
247
bzrdir.BzrDir.open(self.get_url()).open_branch(unsupported=True))
248
controldir.ControlDir.open(self.get_url()).open_branch(unsupported=True))
248
249
# unregister the format
249
250
self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
250
251
_mod_branch.BranchFormat.unregister_format, format)
489
490
def make_branch(self, location, format=None):
490
491
if format is None:
491
format = bzrdir.format_registry.make_bzrdir('1.9')
492
format = controldir.format_registry.make_bzrdir('1.9')
492
493
format.set_branch_format(_mod_branch.BzrBranchFormat8())
493
494
return tests.TestCaseWithTransport.make_branch(
494
495
self, location, format=format)
693
694
'Value "not-a-bool" is not valid for "append_revisions_only"',
694
695
self.warnings[0])
697
def test_use_fresh_values(self):
698
copy = _mod_branch.Branch.open(self.branch.base)
701
copy.get_config_stack().set('foo', 'bar')
704
self.assertFalse(self.branch.is_locked())
705
result = self.branch.get_config_stack().get('foo')
706
# Bug: https://bugs.launchpad.net/bzr/+bug/948339
707
self.expectFailure('Unlocked branches cache their configs',
708
self.assertEqual, 'bar', result)
710
def test_set_from_config_get_from_config_stack(self):
711
self.branch.lock_write()
712
self.addCleanup(self.branch.unlock)
713
self.branch.get_config().set_user_option('foo', 'bar')
714
result = self.branch.get_config_stack().get('foo')
715
# https://bugs.launchpad.net/bzr/+bug/948344
716
self.expectFailure('BranchStack uses cache after set_user_option',
717
self.assertEqual, 'bar', result)
719
def test_set_from_config_stack_get_from_config(self):
720
self.branch.lock_write()
721
self.addCleanup(self.branch.unlock)
722
self.branch.get_config_stack().set('foo', 'bar')
723
self.assertEqual('bar',
724
self.branch.get_config().get_user_option('foo'))
726
def test_set_delays_write(self):
727
self.branch.lock_write()
728
self.addCleanup(self.branch.unlock)
729
self.branch.get_config_stack().set('foo', 'bar')
730
copy = _mod_branch.Branch.open(self.branch.base)
731
result = copy.get_config_stack().get('foo')
732
# Bug: https://bugs.launchpad.net/bzr/+bug/948339
733
self.expectFailure("Config writes are not cached.", self.assertIs,
697
737
class TestPullResult(tests.TestCase):