Rev 6415: (vila) Cleanup the configCommandLineStore implementation. (Vincent Ladeuil) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 3 12:56:07 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6415 [merge]
revision-id: pqm at pqm.ubuntu.com-20120103125606-36p3u22k8kzbhoqc
parent: pqm at pqm.ubuntu.com-20120103123005-3guoyc4jastk4lwk
parent: v.ladeuil+lp at free.fr-20120103112949-kkx7v85zn8t3c4h3
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2012-01-03 12:56:06 +0000
message:
  (vila) Cleanup the configCommandLineStore implementation. (Vincent Ladeuil)
modified:
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/tests/blackbox/test_config.py test_config.py-20100927150753-x6rf54uibd08r636-1
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2012-01-03 12:04:03 +0000
+++ b/bzrlib/config.py	2012-01-03 12:56:06 +0000
@@ -2992,6 +2992,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.
@@ -3015,8 +3016,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):
@@ -3282,6 +3282,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-24 10:10:59 +0000
+++ b/bzrlib/tests/blackbox/test_config.py	2012-01-03 12:56:06 +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	2012-01-03 12:04:03 +0000
+++ b/bzrlib/tests/test_config.py	2012-01-03 12:56:06 +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.TestNotApplicable(
+                "%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	2012-01-03 12:04:03 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-01-03 12:56:06 +0000
@@ -158,6 +158,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