194
193
def test_mailto_option(self):
195
194
b = branch.Branch.open('branch')
196
b.get_config_stack().set('mail_client', 'editor')
195
b.get_config().set_user_option('mail_client', 'editor')
197
196
self.run_bzr_error(
198
197
('No mail-to address \\(--mail-to\\) or output \\(-o\\) specified',
199
198
), 'send -f branch')
200
b.get_config_stack().set('mail_client', 'bogus')
199
b.get_config().set_user_option('mail_client', 'bogus')
201
200
self.run_send([])
202
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
201
self.run_bzr_error(('Unknown mail client: bogus',),
203
202
'send -f branch --mail-to jrandom@example.org')
204
b.get_config_stack().set('submit_to', 'jrandom@example.org')
205
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
203
b.get_config().set_user_option('submit_to', 'jrandom@example.org')
204
self.run_bzr_error(('Unknown mail client: bogus',),
206
205
'send -f branch')
208
207
def test_mailto_child_option(self):
209
208
"""Make sure that child_submit_to is used."""
210
209
b = branch.Branch.open('branch')
211
b.get_config_stack().set('mail_client', 'bogus')
210
b.get_config().set_user_option('mail_client', 'bogus')
212
211
parent = branch.Branch.open('parent')
213
parent.get_config_stack().set('child_submit_to', 'somebody@example.org')
214
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
212
parent.get_config().set_user_option('child_submit_to',
213
'somebody@example.org')
214
self.run_bzr_error(('Unknown mail client: bogus',),
217
217
def test_format(self):
218
218
md = self.get_MD(['--format=4'])
230
230
'send -f branch -o- --format=0.999')[0]
232
232
def test_format_child_option(self):
233
br = branch.Branch.open('parent')
234
conf = br.get_config_stack()
235
conf.set('child_submit_format', '4')
233
parent_config = branch.Branch.open('parent').get_config()
234
parent_config.set_user_option('child_submit_format', '4')
236
235
md = self.get_MD([])
237
236
self.assertIs(merge_directive.MergeDirective2, md.__class__)
239
conf.set('child_submit_format', '0.9')
238
parent_config.set_user_option('child_submit_format', '0.9')
240
239
md = self.get_MD([])
241
240
self.assertFormatIs('# Bazaar revision bundle v0.9', md)
244
243
self.assertFormatIs('# Bazaar revision bundle v0.9', md)
245
244
self.assertIs(merge_directive.MergeDirective, md.__class__)
247
conf.set('child_submit_format', '0.999')
246
parent_config.set_user_option('child_submit_format', '0.999')
248
247
self.run_bzr_error(["No such send format '0.999'"],
249
248
'send -f branch -o-')[0]
294
293
_default_additional_warning = 'Uncommitted changes will not be sent.'
296
295
def set_config_send_strict(self, value):
297
br = branch.Branch.open('local')
298
br.get_config_stack().set('send_strict', value)
296
# set config var (any of bazaar.conf, locations.conf, branch.conf
298
conf = self.local_tree.branch.get_config_stack()
299
conf.set('send_strict', value)
300
301
def assertSendFails(self, args):
301
302
out, err = self.run_send(args, rc=3, err_re=self._default_errors)
331
332
super(TestSendStrictWithoutChanges, self).setUp()
332
333
self.make_parent_and_local_branches()
334
def test_send_without_workingtree(self):
335
ControlDir.open("local").destroy_workingtree()
336
self.assertSendSucceeds([])
338
335
def test_send_default(self):
339
336
self.assertSendSucceeds([])
462
459
# being too low. If rpc_count increases, more network roundtrips have
463
460
# become necessary for this use case. Please do not adjust this number
464
461
# upwards without agreement from bzr's network support maintainers.
465
self.assertLength(7, self.hpss_calls)
466
self.assertLength(1, self.hpss_connections)
462
self.assertLength(9, self.hpss_calls)
467
463
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)