~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Ross Lagerwall
  • Date: 2012-08-07 06:32:51 UTC
  • mto: (6437.63.5 2.5)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: rosslagerwall@gmail.com-20120807063251-x9p03ghg2ws8oqjc
Add bzrlib/locale to .bzrignore

bzrlib/locale is generated with ./setup.py build_mo which is in turn called
by ./setup.py build

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012, 2016 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
20
20
 
21
21
from bzrlib import (
22
22
    branch,
 
23
    bzrdir,
23
24
    merge_directive,
24
25
    tests,
25
26
    )
62
63
 
63
64
    def setUp(self):
64
65
        super(TestSend, self).setUp()
65
 
        grandparent_tree = ControlDir.create_standalone_workingtree(
 
66
        grandparent_tree = bzrdir.BzrDir.create_standalone_workingtree(
66
67
            'grandparent')
67
68
        self.build_tree_contents([('grandparent/file1', 'grandparent')])
68
69
        grandparent_tree.add('file1')
192
193
 
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')
206
207
 
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
 
                'send -f branch')
 
214
        self.run_bzr_error(('Unknown mail client: bogus',), 'send -f branch')
215
215
 
216
216
    def test_format(self):
217
217
        md = self.get_MD(['--format=4'])
229
229
                            'send -f branch -o- --format=0.999')[0]
230
230
 
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__)
237
236
 
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)
241
240
 
243
242
        self.assertFormatIs('# Bazaar revision bundle v0.9', md)
244
243
        self.assertIs(merge_directive.MergeDirective, md.__class__)
245
244
 
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]
249
248
 
274
273
 
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.'
294
293
 
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
 
296
        # should do)
 
297
        conf = self.local_tree.branch.get_config_stack()
 
298
        conf.set('send_strict', value)
298
299
 
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)
318
319
        else:
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)