Rev 6405: Properly support config.CommandLineStore in ``bzr config`` in file:///home/vila/src/bzr/cleanup/config-cmdline/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Dec 23 09:57:23 UTC 2011
At file:///home/vila/src/bzr/cleanup/config-cmdline/
------------------------------------------------------------
revno: 6405
revision-id: v.ladeuil+lp at free.fr-20111223095722-51tqq9dks4h42k91
parent: pqm at pqm.ubuntu.com-20111222185258-wgcba8590pbw5sf1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-cmdline
timestamp: Fri 2011-12-23 10:57:22 +0100
message:
Properly support config.CommandLineStore in ``bzr config``
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-12-21 21:31:03 +0000
+++ b/bzrlib/config.py 2011-12-23 09:57:22 +0000
@@ -2982,6 +2982,7 @@
if opts is None:
opts = {}
self.options = {}
+ self.id = 'cmdline'
def _reset(self):
# The dict should be cleared but not replaced so it can be shared.
@@ -3005,8 +3006,7 @@
return 'cmdline'
def get_sections(self):
- yield self, self.readonly_section_class('cmdline_overrides',
- self.options)
+ yield self, self.readonly_section_class(None, self.options)
class IniFileStore(Store):
@@ -3271,6 +3271,7 @@
super(ControlStore, self).__init__(bzrdir.transport,
'control.conf',
lock_dir_name='branch_lock')
+ self.id = 'control'
class SectionMatcher(object):
=== modified file 'bzrlib/tests/blackbox/test_config.py'
--- a/bzrlib/tests/blackbox/test_config.py 2011-12-21 10:55:43 +0000
+++ b/bzrlib/tests/blackbox/test_config.py 2011-12-23 09:57:22 +0000
@@ -146,6 +146,17 @@
hello = world
''')
+ def test_cmd_line(self):
+ self.bazaar_config.set_user_option('hello', 'world')
+ script.run_script(self, '''\
+ $ bzr config -Ohello=bzr
+ cmdline:
+ hello = bzr
+ bazaar:
+ [DEFAULT]
+ hello = world
+ ''')
+
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2011-12-21 20:32:50 +0000
+++ b/bzrlib/tests/test_config.py 2011-12-23 09:57:22 +0000
@@ -2655,6 +2655,20 @@
self.assertRaises(errors.BzrCommandError,
self.store._from_cmdline, ['a=b', 'c'])
+class TestStoreMinimalAPI(tests.TestCaseWithTransport):
+
+ scenarios = [(key, {'get_store': builder}) for key, builder
+ in config.test_store_builder_registry.iteritems()] + [
+ ('cmdline', {'get_store': lambda test: config.CommandLineStore()})]
+
+ def test_id(self):
+ store = self.get_store(self)
+ if type(store) == config.TransportIniFileStore:
+ raise tests.TestSkipped(
+ "%s is not a concrete Store implementation"
+ " so it doesn't need an id" % (store.__class__.__name__,))
+ self.assertIsNot(None, store.id)
+
class TestStore(tests.TestCaseWithTransport):
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2011-12-22 18:52:58 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2011-12-23 09:57:22 +0000
@@ -150,6 +150,9 @@
speeding up various commands including ``bzr export``,
``bzr checkout`` and ``bzr cat``. (Jelmer Vernooij, #608640)
+* The ``ConfigCommandLineStore`` is now supported by ``bzr config`` and is
+ seen as single no-name section of configuration options. (Vincent Ladeuil)
+
Testing
*******
More information about the bazaar-commits
mailing list