35
36
self.assertEqual('', err)
37
38
def test_remove_unknown_option(self):
38
self.run_bzr_error(['The "file" configuration option does not exist', ],
39
self.run_bzr_error(['The "file" configuration option does not exist',],
39
40
['config', '--remove', 'file'])
41
42
def test_all_remove_exclusive(self):
42
self.run_bzr_error(['--all and --remove are mutually exclusive.', ],
43
self.run_bzr_error(['--all and --remove are mutually exclusive.',],
43
44
['config', '--remove', '--all'])
45
46
def test_all_set_exclusive(self):
46
self.run_bzr_error(['Only one option can be set.', ],
47
self.run_bzr_error(['Only one option can be set.',],
47
48
['config', '--all', 'hello=world'])
49
50
def test_remove_no_option(self):
50
self.run_bzr_error(['--remove expects an option to remove.', ],
51
self.run_bzr_error(['--remove expects an option to remove.',],
51
52
['config', '--remove'])
53
54
def test_unknown_option(self):
54
self.run_bzr_error(['The "file" configuration option does not exist', ],
55
self.run_bzr_error(['The "file" configuration option does not exist',],
55
56
['config', 'file'])
57
58
def test_unexpected_regexp(self):
58
59
self.run_bzr_error(
59
['The "\\*file" configuration option does not exist', ],
60
['The "\*file" configuration option does not exist',],
60
61
['config', '*file'])
62
63
def test_wrong_regexp(self):
63
64
self.run_bzr_error(
64
['Invalid pattern\\(s\\) found. "\\*file" nothing to repeat', ],
65
['Invalid pattern\(s\) found. "\*file" nothing to repeat',],
65
66
['config', '--all', '*file'])
68
70
class TestConfigDisplay(tests.TestCaseWithTransport):
72
74
_t_config.create_configs(self)
74
76
def test_multiline_all_values(self):
75
self.breezy_config.set_user_option('multiline', '1\n2\n')
77
self.bazaar_config.set_user_option('multiline', '1\n2\n')
76
78
# Fallout from bug 710410, the triple quotes have been toggled
77
79
script.run_script(self, '''\
78
80
$ brz config -d tree
86
88
def test_multiline_value_only(self):
87
self.breezy_config.set_user_option('multiline', '1\n2\n')
89
self.bazaar_config.set_user_option('multiline', '1\n2\n')
88
90
# Fallout from bug 710410, the triple quotes have been toggled
89
91
script.run_script(self, '''\
90
92
$ brz config -d tree multiline
96
98
def test_list_value_all(self):
97
99
config.option_registry.register(config.ListOption('list'))
98
100
self.addCleanup(config.option_registry.remove, 'list')
99
self.breezy_config.set_user_option('list', [1, 'a', 'with, a comma'])
101
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
100
102
script.run_script(self, '''\
101
103
$ brz config -d tree
104
106
list = 1, a, "with, a comma"
107
109
def test_list_value_one(self):
108
110
config.option_registry.register(config.ListOption('list'))
109
111
self.addCleanup(config.option_registry.remove, 'list')
110
self.breezy_config.set_user_option('list', [1, 'a', 'with, a comma'])
112
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
111
113
script.run_script(self, '''\
112
114
$ brz config -d tree list
113
115
1, a, "with, a comma"
116
118
def test_registry_value_all(self):
117
self.breezy_config.set_user_option('transform.orphan_policy',
119
self.bazaar_config.set_user_option('bzr.transform.orphan_policy',
119
121
script.run_script(self, '''\
120
122
$ brz config -d tree
123
transform.orphan_policy = move
125
bzr.transform.orphan_policy = move
126
128
def test_registry_value_one(self):
127
self.breezy_config.set_user_option('transform.orphan_policy',
129
self.bazaar_config.set_user_option('bzr.transform.orphan_policy',
129
131
script.run_script(self, '''\
130
$ brz config -d tree transform.orphan_policy
132
$ brz config -d tree bzr.transform.orphan_policy
134
def test_breezy_config(self):
135
self.breezy_config.set_user_option('hello', 'world')
136
def test_bazaar_config(self):
137
self.bazaar_config.set_user_option('hello', 'world')
136
138
script.run_script(self, '''\
137
139
$ brz config -d tree
155
157
def test_locations_config_outside_branch(self):
156
self.breezy_config.set_user_option('hello', 'world')
158
self.bazaar_config.set_user_option('hello', 'world')
157
159
self.locations_config.set_user_option('hello', 'world')
158
160
script.run_script(self, '''\
165
167
def test_cmd_line(self):
166
self.breezy_config.set_user_option('hello', 'world')
168
self.bazaar_config.set_user_option('hello', 'world')
167
169
script.run_script(self, '''\
168
170
$ brz config -Ohello=bzr
217
def test_active_in_breezy(self):
219
def test_active_in_bazaar(self):
218
220
script.run_script(self, '''\
219
$ brz config -d tree --scope breezy file
221
$ brz config -d tree --scope bazaar file
223
225
def test_active_in_branch(self):
240
242
self.run_bzr_error(['The "moon" configuration does not exist'],
241
243
['config', '--scope', 'moon', 'hello=world'])
243
def test_breezy_config_outside_branch(self):
245
def test_bazaar_config_outside_branch(self):
244
246
script.run_script(self, '''\
245
$ brz config --scope breezy hello=world
247
$ brz config --scope bazaar hello=world
246
248
$ brz config -d tree --all hello
252
def test_breezy_config_inside_branch(self):
254
def test_bazaar_config_inside_branch(self):
253
255
script.run_script(self, '''\
254
$ brz config -d tree --scope breezy hello=world
256
$ brz config -d tree --scope bazaar hello=world
255
257
$ brz config -d tree --all hello
294
296
self.run_bzr_error(['The "moon" configuration does not exist'],
295
297
['config', '--scope', 'moon', '--remove', 'file'])
297
def test_breezy_config_outside_branch(self):
299
def test_bazaar_config_outside_branch(self):
298
300
script.run_script(self, '''\
299
$ brz config --scope breezy --remove file
301
$ brz config --scope bazaar --remove file
300
302
$ brz config -d tree --all file
308
def test_breezy_config_inside_branch(self):
310
def test_bazaar_config_inside_branch(self):
309
311
script.run_script(self, '''\
310
$ brz config -d tree --scope breezy --remove file
312
$ brz config -d tree --scope bazaar --remove file
311
313
$ brz config -d tree --all file
359
361
script.run_script(self, '''\
360
362
$ brz config -d tree --scope locations --remove file
361
363
$ brz config -d tree --all file
370
class TestSmartServerConfig(tests.TestCaseWithTransport):
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)
383
self.assertLength(1, self.hpss_connections)
384
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
368
387
class TestConfigDirectory(tests.TestCaseWithTransport):
370
389
def test_parent_alias(self):
371
390
t = self.make_branch_and_tree('base')
372
391
t.branch.get_config_stack().set('test', 'base')
373
clone = t.branch.controldir.sprout('clone').open_branch()
392
clone = t.branch.bzrdir.sprout('clone').open_branch()
374
393
clone.get_config_stack().set('test', 'clone')
375
394
out, err = self.run_bzr(['config', '-d', ':parent', 'test'],
376
395
working_dir='clone')