64
65
super(TestSend, self).setUp()
65
grandparent_tree = ControlDir.create_standalone_workingtree(
66
grandparent_tree = bzrdir.BzrDir.create_standalone_workingtree(
67
68
self.build_tree_contents([('grandparent/file1', 'grandparent')])
68
69
grandparent_tree.add('file1')
193
194
def test_mailto_option(self):
194
195
b = branch.Branch.open('branch')
195
b.get_config_stack().set('mail_client', 'editor')
196
b.get_config().set_user_option('mail_client', 'editor')
196
197
self.run_bzr_error(
197
198
('No mail-to address \\(--mail-to\\) or output \\(-o\\) specified',
198
199
), 'send -f branch')
199
b.get_config_stack().set('mail_client', 'bogus')
200
b.get_config().set_user_option('mail_client', 'bogus')
200
201
self.run_send([])
201
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
202
self.run_bzr_error(('Unknown mail client: bogus',),
202
203
'send -f branch --mail-to jrandom@example.org')
203
204
b.get_config_stack().set('submit_to', 'jrandom@example.org')
204
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
205
self.run_bzr_error(('Unknown mail client: bogus',),
205
206
'send -f branch')
207
208
def test_mailto_child_option(self):
208
209
"""Make sure that child_submit_to is used."""
209
210
b = branch.Branch.open('branch')
210
b.get_config_stack().set('mail_client', 'bogus')
211
b.get_config().set_user_option('mail_client', 'bogus')
211
212
parent = branch.Branch.open('parent')
212
213
parent.get_config_stack().set('child_submit_to', 'somebody@example.org')
213
self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
214
self.run_bzr_error(('Unknown mail client: bogus',), 'send -f branch')
216
216
def test_format(self):
217
217
md = self.get_MD(['--format=4'])
229
229
'send -f branch -o- --format=0.999')[0]
231
231
def test_format_child_option(self):
232
br = branch.Branch.open('parent')
233
conf = br.get_config_stack()
234
conf.set('child_submit_format', '4')
232
parent_config = branch.Branch.open('parent').get_config_stack()
233
parent_config.set('child_submit_format', '4')
235
234
md = self.get_MD([])
236
235
self.assertIs(merge_directive.MergeDirective2, md.__class__)
238
conf.set('child_submit_format', '0.9')
237
parent_config.set('child_submit_format', '0.9')
239
238
md = self.get_MD([])
240
239
self.assertFormatIs('# Bazaar revision bundle v0.9', md)
243
242
self.assertFormatIs('# Bazaar revision bundle v0.9', md)
244
243
self.assertIs(merge_directive.MergeDirective, md.__class__)
246
conf.set('child_submit_format', '0.999')
245
parent_config.set('child_submit_format', '0.999')
247
246
self.run_bzr_error(["No such send format '0.999'"],
248
247
'send -f branch -o-')[0]
275
274
def make_parent_and_local_branches(self):
276
275
# Create a 'parent' branch as the base
277
self.parent_tree = ControlDir.create_standalone_workingtree('parent')
276
self.parent_tree = bzrdir.BzrDir.create_standalone_workingtree('parent')
278
277
self.build_tree_contents([('parent/file', 'parent')])
279
278
self.parent_tree.add('file')
280
279
self.parent_tree.commit('first commit', rev_id='parent')
293
292
_default_additional_warning = 'Uncommitted changes will not be sent.'
295
294
def set_config_send_strict(self, value):
296
br = branch.Branch.open('local')
297
br.get_config_stack().set('send_strict', value)
295
# set config var (any of bazaar.conf, locations.conf, branch.conf
297
conf = self.local_tree.branch.get_config_stack()
298
conf.set('send_strict', value)
299
300
def assertSendFails(self, args):
300
301
out, err = self.run_send(args, rc=3, err_re=self._default_errors)
316
317
self.assertContainsRe(err, self._default_additional_warning)
317
318
self.assertEndsWith(err, bundling_revs)
319
self.assertEqual(bundling_revs, err)
320
self.assertEquals(bundling_revs, err)
320
321
md = merge_directive.MergeDirective.from_lines(StringIO(out))
321
322
self.assertEqual('parent', md.base_revision_id)
322
323
br = serializer.read_bundle(StringIO(md.get_raw_bundle()))
461
462
# being too low. If rpc_count increases, more network roundtrips have
462
463
# become necessary for this use case. Please do not adjust this number
463
464
# upwards without agreement from bzr's network support maintainers.
464
self.assertLength(7, self.hpss_calls)
465
self.assertLength(9, self.hpss_calls)
465
466
self.assertLength(1, self.hpss_connections)
466
467
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)