Rev 6454: (jelmer) Add WorkingTree.get_config_stack(). (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Sat Jan 28 17:24:35 UTC 2012


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

------------------------------------------------------------
revno: 6454 [merge]
revision-id: pqm at pqm.ubuntu.com-20120128172434-05d2rvoz1p92d6zi
parent: pqm at pqm.ubuntu.com-20120128165612-ji88oyq3ghpmzy0g
parent: jelmer at samba.org-20120128163933-joqmv4w1nlkee0sz
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2012-01-28 17:24:34 +0000
message:
  (jelmer) Add WorkingTree.get_config_stack(). (Jelmer Vernooij)
modified:
  bzrlib/tests/per_branch/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/per_workingtree/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/tests/per_branch/test_branch.py'
--- a/bzrlib/tests/per_branch/test_branch.py	2012-01-28 00:39:01 +0000
+++ b/bzrlib/tests/per_branch/test_branch.py	2012-01-28 17:24:34 +0000
@@ -22,7 +22,6 @@
     config,
     delta as _mod_delta,
     errors,
-    gpg,
     merge,
     osutils,
     urlutils,
@@ -529,7 +528,7 @@
             looked_up_format = registry.get(network_name)
             self.assertEqual(format.__class__, looked_up_format.__class__)
 
-    def get_get_config_calls(self):
+    def test_get_config_calls(self):
         # Smoke test that all branch succeed getting a config
         br = self.make_branch('.')
         br.get_config()

=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
--- a/bzrlib/tests/per_workingtree/test_workingtree.py	2012-01-25 21:13:15 +0000
+++ b/bzrlib/tests/per_workingtree/test_workingtree.py	2012-01-28 17:24:34 +0000
@@ -121,6 +121,12 @@
         self.assertEqual(('filename', 'V', 'directory', 'file-id'),
                          result[0][:4])
 
+    def test_get_config_stack(self):
+        # Smoke test that all working trees succeed getting a config
+        wt = self.make_branch_and_tree('.')
+        conf = wt.get_config_stack()
+        self.assertIsInstance(conf, config.Stack)
+
     def test_open_containing(self):
         branch = self.make_branch_and_tree('.').branch
         local_base = urlutils.local_path_from_url(branch.base)
@@ -1200,7 +1206,7 @@
 
     def test_set_in_branch(self):
         wt = self.make_wt_with_worth_saving_limit()
-        conf = config.BranchStack(wt.branch)
+        conf = wt.get_config_stack()
         conf.set('bzr.workingtree.worth_saving_limit', '20')
         self.assertEqual(20, wt._worth_saving_limit())
         ds = wt.current_dirstate()
@@ -1208,7 +1214,7 @@
 
     def test_invalid(self):
         wt = self.make_wt_with_worth_saving_limit()
-        conf = config.BranchStack(wt.branch)
+        conf = wt.get_config_stack()
         conf.set('bzr.workingtree.worth_saving_limit', 'a')
         # If the config entry is invalid, default to 10
         warnings = []

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2012-01-28 12:47:17 +0000
+++ b/bzrlib/workingtree.py	2012-01-28 17:24:34 +0000
@@ -261,6 +261,14 @@
     def supports_views(self):
         return self.views.supports_views()
 
+    def get_config_stack(self):
+        """Retrieve the config stack for this tree.
+
+        :return: A ``bzrlib.config.Stack``
+        """
+        # For the moment, just provide the branch config stack.
+        return self.branch.get_config_stack()
+
     @staticmethod
     def open(path=None, _unsupported=False):
         """Open an existing working tree at path.

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2012-01-27 20:19:13 +0000
+++ b/bzrlib/workingtree_4.py	2012-01-27 20:45:42 +0000
@@ -255,8 +255,7 @@
 
         :return: an integer. -1 means never save.
         """
-        # FIXME: We want a WorkingTreeStack here -- vila 20110812
-        conf = config.BranchStack(self.branch)
+        conf = self.get_config_stack()
         return conf.get('bzr.workingtree.worth_saving_limit')
 
     def filter_unversioned_files(self, paths):

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-01-28 12:47:17 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-01-28 17:24:34 +0000
@@ -90,6 +90,9 @@
 * ``ControlDir`` now has a new method ``set_branch_reference`` which can
   be used for setting branch references. (Jelmer Vernooij)
 
+* New convenience API method ``WorkingTree.get_config_stack``.
+  (Jelmer Vernooij)
+
 Internals
 *********
 




More information about the bazaar-commits mailing list