~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_send.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 17:14:34 UTC
  • mfrom: (6378.1.5 config-si-unit)
  • Revision ID: pqm@pqm.ubuntu.com-20111219171434-i0b4ir0invs9il2v
(vila) Migrate add.maximum_file_size configuration option. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
# Authors: Aaron Bentley
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
24
24
    merge_directive,
25
25
    tests,
26
26
    )
27
 
from bzrlib.controldir import ControlDir
28
27
from bzrlib.bundle import serializer
29
28
from bzrlib.transport import memory
30
29
from bzrlib.tests import (
193
192
 
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')
207
206
 
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"',),
215
 
                'send -f branch')
 
212
        parent.get_config().set_user_option('child_submit_to',
 
213
                           'somebody@example.org')
 
214
        self.run_bzr_error(('Unknown mail client: bogus',),
 
215
                           'send -f branch')
216
216
 
217
217
    def test_format(self):
218
218
        md = self.get_MD(['--format=4'])
230
230
                            'send -f branch -o- --format=0.999')[0]
231
231
 
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__)
238
237
 
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)
242
241
 
244
243
        self.assertFormatIs('# Bazaar revision bundle v0.9', md)
245
244
        self.assertIs(merge_directive.MergeDirective, md.__class__)
246
245
 
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]
250
249
 
294
293
    _default_additional_warning = 'Uncommitted changes will not be sent.'
295
294
 
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
 
297
        # should do)
 
298
        conf = self.local_tree.branch.get_config_stack()
 
299
        conf.set('send_strict', value)
299
300
 
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()
333
334
 
334
 
    def test_send_without_workingtree(self):
335
 
        ControlDir.open("local").destroy_workingtree()
336
 
        self.assertSendSucceeds([])
337
 
 
338
335
    def test_send_default(self):
339
336
        self.assertSendSucceeds([])
340
337
 
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)