Rev 6101: Bah, cross stores expansion already works of course, tests added. in file:///home/vila/src/bzr/bugs/832013-expand-in-stack/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Sep 12 15:08:20 UTC 2011


At file:///home/vila/src/bzr/bugs/832013-expand-in-stack/

------------------------------------------------------------
revno: 6101
revision-id: v.ladeuil+lp at free.fr-20110912150819-g3mq6lokfz9ntww5
parent: v.ladeuil+lp at free.fr-20110908080335-ddel4ir5grz945xa
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 832013-expand-in-stack
timestamp: Mon 2011-09-12 17:08:19 +0200
message:
  Bah, cross stores expansion already works of course, tests added.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-09-07 15:21:39 +0000
+++ b/bzrlib/config.py	2011-09-12 15:08:19 +0000
@@ -3167,11 +3167,6 @@
             # anything else
             value = env[name]
         else:
-            # FIXME: This is a limited implementation, what we really need is a
-            # way to query the bzr config for the value of an option,
-            # respecting the scope rules (That is, once we implement fallback
-            # configs, getting the option value should restart from the top
-            # config, not the current one) -- vila 20101222
             value = self.get(name, expand=False)
             value = self._expand_options_in_string(value, env, _refs)
         return value

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-09-07 15:21:39 +0000
+++ b/bzrlib/tests/test_config.py	2011-09-12 15:08:19 +0000
@@ -3560,6 +3560,29 @@
         self.assertEquals('quux', c.get('bar', expand=True))
 
 
+class TestStackCrossStoresExpand(tests.TestCaseWithTransport):
+
+    def test_cross_global_locations(self):
+        l_store = config.LocationStore()
+        l_store._load_from_string('''
+[/branch]
+lfoo = loc-foo
+lbar = {gbar}
+''')
+        l_store.save()
+        g_store = config.GlobalStore()
+        g_store._load_from_string('''
+[DEFAULT]
+gfoo = {lfoo}
+gbar = glob-bar
+''')
+        g_store.save()
+        stack = config.LocationStack('/branch')
+        self.debug()
+        self.assertEquals('glob-bar', stack.get('lbar', expand=True))
+        self.assertEquals('loc-foo', stack.get('gfoo', expand=True))
+
+
 class TestStackSet(TestStackWithTransport):
 
     def test_simple_set(self):



More information about the bazaar-commits mailing list