Rev 6262: Only the DEFAULT section is searched for the normal uses of bazaar.conf in file:///home/vila/src/bzr/experimental/config-command/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Nov 16 17:19:13 UTC 2011
At file:///home/vila/src/bzr/experimental/config-command/
------------------------------------------------------------
revno: 6262
revision-id: v.ladeuil+lp at free.fr-20111116171913-6axpxlhb35y2d4sh
parent: v.ladeuil+lp at free.fr-20111116155714-6a15q7tcjsfax0iu
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-command
timestamp: Wed 2011-11-16 18:19:13 +0100
message:
Only the DEFAULT section is searched for the normal uses of bazaar.conf
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-11-16 15:57:14 +0000
+++ b/bzrlib/config.py 2011-11-16 17:19:13 +0000
@@ -2996,7 +2996,7 @@
# This is where we require loading the store so we can see all defined
# sections.
sections = self.store.get_sections()
- # Walk the revisions in the provided order
+ # Walk the revisions in the order provided
for store, s in sections:
if self.match(s):
yield store, s
@@ -3351,7 +3351,7 @@
# Get a GlobalStore
gstore = GlobalStore()
super(GlobalStack, self).__init__(
- [self._get_overrides, gstore.get_sections],
+ [self._get_overrides, NameMatcher(gstore, 'DEFAULT').get_sections],
gstore, mutable_section_id='DEFAULT')
@@ -3371,7 +3371,7 @@
gstore = GlobalStore()
super(LocationStack, self).__init__(
[self._get_overrides,
- matcher.get_sections, gstore.get_sections],
+ matcher.get_sections, NameMatcher(gstore, 'DEFAULT').get_sections],
lstore, mutable_section_id=location)
@@ -3385,7 +3385,8 @@
gstore = GlobalStore()
super(BranchStack, self).__init__(
[self._get_overrides,
- matcher.get_sections, bstore.get_sections, gstore.get_sections],
+ matcher.get_sections, bstore.get_sections,
+ NameMatcher(gstore, 'DEFAULT').get_sections],
bstore)
self.branch = branch
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2011-11-16 15:57:14 +0000
+++ b/bzrlib/tests/test_config.py 2011-11-16 17:19:13 +0000
@@ -3339,7 +3339,7 @@
self.assertEquals(None, self.conf.get('foo'))
def test_get_hook(self):
- self.conf.store._load_from_string('foo=bar')
+ self.conf.set('foo', 'bar')
calls = []
def hook(*args):
calls.append(args)
@@ -3351,12 +3351,17 @@
self.assertEquals((self.conf, 'foo', 'bar'), calls[0])
-class TestStackGetWithConverter(TestStackGet):
+class TestStackGetWithConverter(tests.TestCaseWithTransport):
def setUp(self):
super(TestStackGetWithConverter, self).setUp()
self.overrideAttr(config, 'option_registry', config.OptionRegistry())
self.registry = config.option_registry
+ # We just want a simple stack with a simple store so we can inject
+ # whatever content the tests need without caring about what section
+ # names are valid for a given store/stack.
+ store = config.IniFileStore(self.get_transport(), 'foo.conf')
+ self.conf = config.Stack([store.get_sections], store)
def register_bool_option(self, name, default=None, default_from_env=None):
b = config.Option(name, help='A boolean.',
@@ -3728,8 +3733,7 @@
def test_simple_set(self):
conf = self.get_stack(self)
- conf.store._load_from_string('foo=bar')
- self.assertEquals('bar', conf.get('foo'))
+ self.assertEquals(None, conf.get('foo'))
conf.set('foo', 'baz')
# Did we get it back ?
self.assertEquals('baz', conf.get('foo'))
=== modified file 'bzrlib/tests/test_debug.py'
--- a/bzrlib/tests/test_debug.py 2011-08-12 16:25:56 +0000
+++ b/bzrlib/tests/test_debug.py 2011-11-16 17:19:13 +0000
@@ -34,7 +34,7 @@
def assertDebugFlags(self, expected_flags, conf_bytes):
conf = config.GlobalStack()
- conf.store._load_from_string(conf_bytes)
+ conf.store._load_from_string('[DEFAULT]\n' + conf_bytes)
conf.store.save()
self.overrideAttr(debug, 'debug_flags', set())
debug.set_debug_flags_from_config()
=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py 2011-06-14 01:26:41 +0000
+++ b/bzrlib/tests/test_msgeditor.py 2011-11-16 17:19:13 +0000
@@ -252,9 +252,9 @@
self.overrideEnv('VISUAL', 'visual')
self.overrideEnv('EDITOR', 'editor')
- conf = config.GlobalConfig.from_string('editor = config_editor\n',
- save=True)
-
+ conf = config.GlobalStack()
+ conf.store._load_from_string('[DEFAULT]\neditor = config_editor\n')
+ conf.store.save()
editors = list(msgeditor._get_editor())
editors = [editor for (editor, cfg_src) in editors]
More information about the bazaar-commits
mailing list