5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
1 |
# Copyright (C) 2010 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
||
18 |
"""Black-box tests for bzr config."""
|
|
19 |
||
20 |
from bzrlib import ( |
|
21 |
config, |
|
22 |
tests, |
|
23 |
)
|
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
24 |
from bzrlib.tests import ( |
25 |
script, |
|
26 |
test_config as _t_config, |
|
27 |
)
|
|
6352.2.3
by Jelmer Vernooij
s/NoVfsCalls/ContainsNoVfsCalls/. |
28 |
from bzrlib.tests.matchers import ContainsNoVfsCalls |
6352.2.2
by Jelmer Vernooij
Use new NoVfsCalls matcher in blackbox tests. |
29 |
|
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
30 |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
31 |
class TestWithoutConfig(tests.TestCaseWithTransport): |
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
32 |
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
33 |
def test_config_all(self): |
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
34 |
out, err = self.run_bzr(['config']) |
35 |
self.assertEquals('', out) |
|
36 |
self.assertEquals('', err) |
|
37 |
||
5506.2.2
by Vincent Ladeuil
Raise an error if the option doesn't exist and --active is used. |
38 |
def test_remove_unknown_option(self): |
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
39 |
self.run_bzr_error(['The "file" configuration option does not exist',], |
40 |
['config', '--remove', 'file']) |
|
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
41 |
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
42 |
def test_all_remove_exclusive(self): |
43 |
self.run_bzr_error(['--all and --remove are mutually exclusive.',], |
|
44 |
['config', '--remove', '--all']) |
|
45 |
||
46 |
def test_all_set_exclusive(self): |
|
47 |
self.run_bzr_error(['Only one option can be set.',], |
|
48 |
['config', '--all', 'hello=world']) |
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
49 |
|
5506.2.2
by Vincent Ladeuil
Raise an error if the option doesn't exist and --active is used. |
50 |
def test_remove_no_option(self): |
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
51 |
self.run_bzr_error(['--remove expects an option to remove.',], |
52 |
['config', '--remove']) |
|
53 |
||
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
54 |
def test_unknown_option(self): |
5506.2.2
by Vincent Ladeuil
Raise an error if the option doesn't exist and --active is used. |
55 |
self.run_bzr_error(['The "file" configuration option does not exist',], |
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
56 |
['config', 'file']) |
57 |
||
58 |
def test_unexpected_regexp(self): |
|
59 |
self.run_bzr_error( |
|
60 |
['The "\*file" configuration option does not exist',], |
|
61 |
['config', '*file']) |
|
62 |
||
63 |
def test_wrong_regexp(self): |
|
64 |
self.run_bzr_error( |
|
65 |
['Invalid pattern\(s\) found. "\*file" nothing to repeat',], |
|
66 |
['config', '--all', '*file']) |
|
67 |
||
5506.2.2
by Vincent Ladeuil
Raise an error if the option doesn't exist and --active is used. |
68 |
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
69 |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
70 |
class TestConfigDisplay(tests.TestCaseWithTransport): |
71 |
||
72 |
def setUp(self): |
|
73 |
super(TestConfigDisplay, self).setUp() |
|
74 |
_t_config.create_configs(self) |
|
75 |
||
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
76 |
def test_multiline_all_values(self): |
77 |
self.bazaar_config.set_user_option('multiline', '1\n2\n') |
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
78 |
# Fallout from bug 710410, the triple quotes have been toggled
|
79 |
script.run_script(self, '''\ |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
80 |
$ bzr config -d tree
|
81 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
82 |
[DEFAULT]
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
83 |
multiline = """1
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
84 |
2
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
85 |
"""
|
86 |
''') |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
87 |
|
88 |
def test_multiline_value_only(self): |
|
89 |
self.bazaar_config.set_user_option('multiline', '1\n2\n') |
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
90 |
# Fallout from bug 710410, the triple quotes have been toggled
|
91 |
script.run_script(self, '''\ |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
92 |
$ bzr config -d tree multiline
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
93 |
"""1
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
94 |
2
|
5609.20.3
by Vincent Ladeuil
Fix pqm failures. |
95 |
"""
|
96 |
''') |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
97 |
|
6466.1.1
by Vincent Ladeuil
Fix RegistryOption display in bzr config output |
98 |
def test_list_value_all(self): |
6385.1.1
by Vincent Ladeuil
Stores allow Stacks to control when values are quoted/unquoted |
99 |
config.option_registry.register(config.ListOption('list')) |
100 |
self.addCleanup(config.option_registry.remove, 'list') |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
101 |
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma']) |
102 |
script.run_script(self, '''\ |
|
103 |
$ bzr config -d tree
|
|
104 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
105 |
[DEFAULT]
|
6385.1.1
by Vincent Ladeuil
Stores allow Stacks to control when values are quoted/unquoted |
106 |
list = 1, a, "with, a comma"
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
107 |
''') |
108 |
||
6466.1.1
by Vincent Ladeuil
Fix RegistryOption display in bzr config output |
109 |
def test_list_value_one(self): |
6385.1.1
by Vincent Ladeuil
Stores allow Stacks to control when values are quoted/unquoted |
110 |
config.option_registry.register(config.ListOption('list')) |
111 |
self.addCleanup(config.option_registry.remove, 'list') |
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
112 |
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma']) |
113 |
script.run_script(self, '''\ |
|
114 |
$ bzr config -d tree list
|
|
6385.1.1
by Vincent Ladeuil
Stores allow Stacks to control when values are quoted/unquoted |
115 |
1, a, "with, a comma"
|
5533.2.1
by Vincent Ladeuil
``bzr config`` properly displays list values |
116 |
''') |
117 |
||
6466.1.1
by Vincent Ladeuil
Fix RegistryOption display in bzr config output |
118 |
def test_registry_value_all(self): |
119 |
self.bazaar_config.set_user_option('bzr.transform.orphan_policy', |
|
120 |
u'move') |
|
121 |
script.run_script(self, '''\ |
|
122 |
$ bzr config -d tree
|
|
123 |
bazaar:
|
|
124 |
[DEFAULT]
|
|
125 |
bzr.transform.orphan_policy = move
|
|
126 |
''') |
|
127 |
||
128 |
def test_registry_value_one(self): |
|
129 |
self.bazaar_config.set_user_option('bzr.transform.orphan_policy', |
|
130 |
u'move') |
|
131 |
script.run_script(self, '''\ |
|
132 |
$ bzr config -d tree bzr.transform.orphan_policy
|
|
133 |
move
|
|
134 |
''') |
|
135 |
||
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
136 |
def test_bazaar_config(self): |
137 |
self.bazaar_config.set_user_option('hello', 'world') |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
138 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
139 |
$ bzr config -d tree
|
140 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
141 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
142 |
hello = world
|
143 |
''') |
|
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
144 |
|
145 |
def test_locations_config_for_branch(self): |
|
146 |
self.locations_config.set_user_option('hello', 'world') |
|
147 |
self.branch_config.set_user_option('hello', 'you') |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
148 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
149 |
$ bzr config -d tree
|
150 |
locations:
|
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
151 |
[.../tree]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
152 |
hello = world
|
153 |
branch:
|
|
154 |
hello = you
|
|
155 |
''') |
|
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
156 |
|
157 |
def test_locations_config_outside_branch(self): |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
158 |
self.bazaar_config.set_user_option('hello', 'world') |
5447.4.2
by Vincent Ladeuil
Implement the 'brz config' command. Read-only. |
159 |
self.locations_config.set_user_option('hello', 'world') |
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
160 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
161 |
$ bzr config
|
162 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
163 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
164 |
hello = world
|
165 |
''') |
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
166 |
|
6404.4.1
by Vincent Ladeuil
Properly support config.CommandLineStore in ``bzr config`` |
167 |
def test_cmd_line(self): |
168 |
self.bazaar_config.set_user_option('hello', 'world') |
|
169 |
script.run_script(self, '''\ |
|
170 |
$ bzr config -Ohello=bzr
|
|
171 |
cmdline:
|
|
172 |
hello = bzr
|
|
173 |
bazaar:
|
|
174 |
[DEFAULT]
|
|
175 |
hello = world
|
|
176 |
''') |
|
177 |
||
6385.1.1
by Vincent Ladeuil
Stores allow Stacks to control when values are quoted/unquoted |
178 |
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
179 |
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport): |
180 |
||
181 |
def test_location_with_policy(self): |
|
182 |
# LocationConfig is the only one dealing with policies so far.
|
|
183 |
self.make_branch_and_tree('tree') |
|
184 |
config_text = """\ |
|
185 |
[%(dir)s] |
|
186 |
url = dir
|
|
187 |
url:policy = appendpath
|
|
188 |
[%(dir)s/tree] |
|
189 |
url = tree
|
|
190 |
""" % {'dir': self.test_dir} |
|
191 |
# We don't use the config directly so we save it to disk
|
|
192 |
config.LocationConfig.from_string(config_text, 'tree', save=True) |
|
193 |
# policies are displayed with their options since they are part of
|
|
194 |
# their definition, likewise the path is not appended, we are just
|
|
195 |
# presenting the relevant portions of the config files
|
|
196 |
script.run_script(self, '''\ |
|
197 |
$ bzr config -d tree --all url
|
|
198 |
locations:
|
|
199 |
[.../work/tree]
|
|
200 |
url = tree
|
|
201 |
[.../work]
|
|
202 |
url = dir
|
|
203 |
url:policy = appendpath
|
|
204 |
''') |
|
205 |
||
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
206 |
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
207 |
class TestConfigActive(tests.TestCaseWithTransport): |
208 |
||
209 |
def setUp(self): |
|
210 |
super(TestConfigActive, self).setUp() |
|
211 |
_t_config.create_configs_with_file_option(self) |
|
212 |
||
213 |
def test_active_in_locations(self): |
|
214 |
script.run_script(self, '''\ |
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
215 |
$ bzr config -d tree file
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
216 |
locations
|
217 |
''') |
|
218 |
||
219 |
def test_active_in_bazaar(self): |
|
220 |
script.run_script(self, '''\ |
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
221 |
$ bzr config -d tree --scope bazaar file
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
222 |
bazaar
|
223 |
''') |
|
224 |
||
225 |
def test_active_in_branch(self): |
|
226 |
# We need to delete the locations definition that overrides the branch
|
|
227 |
# one
|
|
228 |
script.run_script(self, '''\ |
|
6260.3.1
by Vincent Ladeuil
Switch ``bzr config`` to the new config implementation |
229 |
$ bzr config -d tree --scope locations --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
230 |
$ bzr config -d tree file
|
5506.2.1
by Vincent Ladeuil
Implements ``bzr config --active option`` displaying only the value. |
231 |
branch
|
232 |
''') |
|
233 |
||
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
234 |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
235 |
class TestConfigSetOption(tests.TestCaseWithTransport): |
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
236 |
|
237 |
def setUp(self): |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
238 |
super(TestConfigSetOption, self).setUp() |
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
239 |
_t_config.create_configs(self) |
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
240 |
|
241 |
def test_unknown_config(self): |
|
5447.4.10
by Vincent Ladeuil
Using dedicated exceptions feels cleaner. |
242 |
self.run_bzr_error(['The "moon" configuration does not exist'], |
5447.4.17
by Vincent Ladeuil
Rename config --force to config --scope. |
243 |
['config', '--scope', 'moon', 'hello=world']) |
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
244 |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
245 |
def test_bazaar_config_outside_branch(self): |
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
246 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
247 |
$ bzr config --scope bazaar hello=world
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
248 |
$ bzr config -d tree --all hello
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
249 |
bazaar:
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
250 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
251 |
hello = world
|
252 |
''') |
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
253 |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
254 |
def test_bazaar_config_inside_branch(self): |
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
255 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
256 |
$ bzr config -d tree --scope bazaar hello=world
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
257 |
$ bzr config -d tree --all hello
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
258 |
bazaar:
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
259 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
260 |
hello = world
|
261 |
''') |
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
262 |
|
263 |
def test_locations_config_inside_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
264 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
265 |
$ bzr config -d tree --scope locations hello=world
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
266 |
$ bzr config -d tree --all hello
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
267 |
locations:
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
268 |
[.../work/tree]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
269 |
hello = world
|
270 |
''') |
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
271 |
|
272 |
def test_branch_config_default(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
273 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
274 |
$ bzr config -d tree hello=world
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
275 |
$ bzr config -d tree --all hello
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
276 |
branch:
|
277 |
hello = world
|
|
278 |
''') |
|
5447.4.5
by Vincent Ladeuil
Implement ``bzr config option=value``. |
279 |
|
280 |
def test_branch_config_forcing_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
281 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
282 |
$ bzr config -d tree --scope branch hello=world
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
283 |
$ bzr config -d tree --all hello
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
284 |
branch:
|
285 |
hello = world
|
|
286 |
''') |
|
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
287 |
|
288 |
||
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
289 |
class TestConfigRemoveOption(tests.TestCaseWithTransport): |
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
290 |
|
291 |
def setUp(self): |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
292 |
super(TestConfigRemoveOption, self).setUp() |
5447.4.6
by Vincent Ladeuil
Start defining fixtures but we still have an unexpected sucessful test. |
293 |
_t_config.create_configs_with_file_option(self) |
294 |
||
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
295 |
def test_unknown_config(self): |
296 |
self.run_bzr_error(['The "moon" configuration does not exist'], |
|
5447.4.17
by Vincent Ladeuil
Rename config --force to config --scope. |
297 |
['config', '--scope', 'moon', '--remove', 'file']) |
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
298 |
|
299 |
def test_bazaar_config_outside_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
300 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
301 |
$ bzr config --scope bazaar --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
302 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
303 |
locations:
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
304 |
[.../work/tree]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
305 |
file = locations
|
306 |
branch:
|
|
307 |
file = branch
|
|
308 |
''') |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
309 |
|
310 |
def test_bazaar_config_inside_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
311 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
312 |
$ bzr config -d tree --scope bazaar --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
313 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
314 |
locations:
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
315 |
[.../work/tree]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
316 |
file = locations
|
317 |
branch:
|
|
318 |
file = branch
|
|
319 |
''') |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
320 |
|
321 |
def test_locations_config_inside_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
322 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
323 |
$ bzr config -d tree --scope locations --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
324 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
325 |
branch:
|
326 |
file = branch
|
|
327 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
328 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
329 |
file = bazaar
|
330 |
''') |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
331 |
|
332 |
def test_branch_config_default(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
333 |
script.run_script(self, '''\ |
6260.3.1
by Vincent Ladeuil
Switch ``bzr config`` to the new config implementation |
334 |
$ bzr config -d tree --scope locations --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
335 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
336 |
branch:
|
337 |
file = branch
|
|
338 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
339 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
340 |
file = bazaar
|
341 |
''') |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
342 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
343 |
$ bzr config -d tree --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
344 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
345 |
bazaar:
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
346 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
347 |
file = bazaar
|
348 |
''') |
|
5447.4.11
by Vincent Ladeuil
Implement ``bzr config --remove <option>``. |
349 |
|
350 |
def test_branch_config_forcing_branch(self): |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
351 |
script.run_script(self, '''\ |
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
352 |
$ bzr config -d tree --scope branch --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
353 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
354 |
locations:
|
5533.1.1
by Vincent Ladeuil
Fix ``bzr config`` to respect policies when displaying values and also display sections when appropriate. |
355 |
[.../work/tree]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
356 |
file = locations
|
357 |
bazaar:
|
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
358 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
359 |
file = bazaar
|
360 |
''') |
|
5447.4.18
by Vincent Ladeuil
Use a coherent script syntax. |
361 |
script.run_script(self, '''\ |
6260.3.1
by Vincent Ladeuil
Switch ``bzr config`` to the new config implementation |
362 |
$ bzr config -d tree --scope locations --remove file
|
5506.2.3
by Vincent Ladeuil
Take review comments into account and drive-by fix bug #670251 |
363 |
$ bzr config -d tree --all file
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
364 |
bazaar:
|
6393.2.2
by Vincent Ladeuil
Display [DEFAULT] when reporting options from bazaar.conf. |
365 |
[DEFAULT]
|
5447.4.20
by Vincent Ladeuil
Indent inplace files. |
366 |
file = bazaar
|
367 |
''') |
|
6270.1.2
by Jelmer Vernooij
Add test for number of roundtrips of 'bzr config -d'. |
368 |
|
369 |
||
370 |
class TestSmartServerConfig(tests.TestCaseWithTransport): |
|
371 |
||
372 |
def test_simple_branch_config(self): |
|
373 |
self.setup_smart_server_with_call_log() |
|
374 |
t = self.make_branch_and_tree('branch') |
|
375 |
self.reset_smart_call_log() |
|
376 |
out, err = self.run_bzr(['config', '-d', self.get_url('branch')]) |
|
377 |
# This figure represent the amount of work to perform this use case. It
|
|
378 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
379 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
380 |
# become necessary for this use case. Please do not adjust this number
|
|
381 |
# upwards without agreement from bzr's network support maintainers.
|
|
382 |
self.assertLength(5, self.hpss_calls) |
|
6366.1.4
by Jelmer Vernooij
Test connection count calls for most blackbox commands. |
383 |
self.assertLength(1, self.hpss_connections) |
6352.2.3
by Jelmer Vernooij
s/NoVfsCalls/ContainsNoVfsCalls/. |
384 |
self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
6437.66.2
by Vincent Ladeuil
Add a proper tests relying on ':parent' as *a* directory service. |
385 |
|
386 |
||
387 |
class TestConfigDirectory(tests.TestCaseWithTransport): |
|
388 |
||
389 |
def test_parent_alias(self): |
|
390 |
t = self.make_branch_and_tree('base') |
|
391 |
t.branch.get_config_stack().set('test', 'base') |
|
392 |
clone = t.branch.bzrdir.sprout('clone').open_branch() |
|
393 |
clone.get_config_stack().set('test', 'clone') |
|
394 |
out, err = self.run_bzr(['config', '-d', ':parent', 'test'], |
|
395 |
working_dir='clone') |
|
396 |
self.assertEquals('base\n', out) |