Merge lp:~jelmer/bzr/working-tree-config-stack into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6454
Proposed branch: lp:~jelmer/bzr/working-tree-config-stack
Merge into: lp:bzr
Diff against target: 101 lines (+21/-6)
5 files modified
bzrlib/tests/per_branch/test_branch.py (+1/-2)
bzrlib/tests/per_workingtree/test_workingtree.py (+8/-2)
bzrlib/workingtree.py (+8/-0)
bzrlib/workingtree_4.py (+1/-2)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/working-tree-config-stack
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+90525@code.launchpad.net

Commit message

Add WorkingTree.get_config_stack().

Description of the change

Add WorkingTree.get_config_stack() and use it.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

29 + def test_get_config(self):

test_get_config_stack.

64 + def get_config_stack(self):
65 + return self.branch.get_config_stack()

Bah, of course ;) Comment to remind that it's only the branch conf that is
taken into account for now ?

Again, I'm surprised there are no more call sites that needs to migrate from
branch to tree config, but again, this can wait.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/per_branch/test_branch.py'
--- bzrlib/tests/per_branch/test_branch.py 2012-01-28 00:39:01 +0000
+++ bzrlib/tests/per_branch/test_branch.py 2012-01-28 16:42:24 +0000
@@ -22,7 +22,6 @@
22 config,22 config,
23 delta as _mod_delta,23 delta as _mod_delta,
24 errors,24 errors,
25 gpg,
26 merge,25 merge,
27 osutils,26 osutils,
28 urlutils,27 urlutils,
@@ -529,7 +528,7 @@
529 looked_up_format = registry.get(network_name)528 looked_up_format = registry.get(network_name)
530 self.assertEqual(format.__class__, looked_up_format.__class__)529 self.assertEqual(format.__class__, looked_up_format.__class__)
531530
532 def get_get_config_calls(self):531 def test_get_config_calls(self):
533 # Smoke test that all branch succeed getting a config532 # Smoke test that all branch succeed getting a config
534 br = self.make_branch('.')533 br = self.make_branch('.')
535 br.get_config()534 br.get_config()
536535
=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
--- bzrlib/tests/per_workingtree/test_workingtree.py 2012-01-25 21:13:15 +0000
+++ bzrlib/tests/per_workingtree/test_workingtree.py 2012-01-28 16:42:24 +0000
@@ -121,6 +121,12 @@
121 self.assertEqual(('filename', 'V', 'directory', 'file-id'),121 self.assertEqual(('filename', 'V', 'directory', 'file-id'),
122 result[0][:4])122 result[0][:4])
123123
124 def test_get_config_stack(self):
125 # Smoke test that all working trees succeed getting a config
126 wt = self.make_branch_and_tree('.')
127 conf = wt.get_config_stack()
128 self.assertIsInstance(conf, config.Stack)
129
124 def test_open_containing(self):130 def test_open_containing(self):
125 branch = self.make_branch_and_tree('.').branch131 branch = self.make_branch_and_tree('.').branch
126 local_base = urlutils.local_path_from_url(branch.base)132 local_base = urlutils.local_path_from_url(branch.base)
@@ -1200,7 +1206,7 @@
12001206
1201 def test_set_in_branch(self):1207 def test_set_in_branch(self):
1202 wt = self.make_wt_with_worth_saving_limit()1208 wt = self.make_wt_with_worth_saving_limit()
1203 conf = config.BranchStack(wt.branch)1209 conf = wt.get_config_stack()
1204 conf.set('bzr.workingtree.worth_saving_limit', '20')1210 conf.set('bzr.workingtree.worth_saving_limit', '20')
1205 self.assertEqual(20, wt._worth_saving_limit())1211 self.assertEqual(20, wt._worth_saving_limit())
1206 ds = wt.current_dirstate()1212 ds = wt.current_dirstate()
@@ -1208,7 +1214,7 @@
12081214
1209 def test_invalid(self):1215 def test_invalid(self):
1210 wt = self.make_wt_with_worth_saving_limit()1216 wt = self.make_wt_with_worth_saving_limit()
1211 conf = config.BranchStack(wt.branch)1217 conf = wt.get_config_stack()
1212 conf.set('bzr.workingtree.worth_saving_limit', 'a')1218 conf.set('bzr.workingtree.worth_saving_limit', 'a')
1213 # If the config entry is invalid, default to 101219 # If the config entry is invalid, default to 10
1214 warnings = []1220 warnings = []
12151221
=== modified file 'bzrlib/workingtree.py'
--- bzrlib/workingtree.py 2012-01-28 12:47:17 +0000
+++ bzrlib/workingtree.py 2012-01-28 16:42:24 +0000
@@ -261,6 +261,14 @@
261 def supports_views(self):261 def supports_views(self):
262 return self.views.supports_views()262 return self.views.supports_views()
263263
264 def get_config_stack(self):
265 """Retrieve the config stack for this tree.
266
267 :return: A ``bzrlib.config.Stack``
268 """
269 # For the moment, just provide the branch config stack.
270 return self.branch.get_config_stack()
271
264 @staticmethod272 @staticmethod
265 def open(path=None, _unsupported=False):273 def open(path=None, _unsupported=False):
266 """Open an existing working tree at path.274 """Open an existing working tree at path.
267275
=== modified file 'bzrlib/workingtree_4.py'
--- bzrlib/workingtree_4.py 2012-01-27 20:19:13 +0000
+++ bzrlib/workingtree_4.py 2012-01-28 16:42:24 +0000
@@ -255,8 +255,7 @@
255255
256 :return: an integer. -1 means never save.256 :return: an integer. -1 means never save.
257 """257 """
258 # FIXME: We want a WorkingTreeStack here -- vila 20110812258 conf = self.get_config_stack()
259 conf = config.BranchStack(self.branch)
260 return conf.get('bzr.workingtree.worth_saving_limit')259 return conf.get('bzr.workingtree.worth_saving_limit')
261260
262 def filter_unversioned_files(self, paths):261 def filter_unversioned_files(self, paths):
263262
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2012-01-28 12:47:17 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2012-01-28 16:42:24 +0000
@@ -90,6 +90,9 @@
90* ``ControlDir`` now has a new method ``set_branch_reference`` which can90* ``ControlDir`` now has a new method ``set_branch_reference`` which can
91 be used for setting branch references. (Jelmer Vernooij)91 be used for setting branch references. (Jelmer Vernooij)
9292
93* New convenience API method ``WorkingTree.get_config_stack``.
94 (Jelmer Vernooij)
95
93Internals96Internals
94*********97*********
9598