~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Packman
  • Date: 2012-01-05 09:50:04 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6426.
  • Revision ID: martin.packman@canonical.com-20120105095004-mia9xb7y0efmto0v
Merge bzr.dev to resolve conflicts in bzrlib.builtins

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
 
19
 
import sys
20
19
from cStringIO import StringIO
21
20
 
22
21
from bzrlib import (
29
28
from bzrlib.transport import memory
30
29
from bzrlib.tests import (
31
30
    scenarios,
32
 
    script,
33
31
    )
 
32
from bzrlib.tests.matchers import ContainsNoVfsCalls
34
33
 
35
34
 
36
35
load_tests = scenarios.load_tests_apply_scenarios
189
188
 
190
189
    def test_note_revisions(self):
191
190
        stderr = self.run_send([])[1]
192
 
        self.assertEndsWith(stderr, '\nBundling 1 revision(s).\n')
 
191
        self.assertEndsWith(stderr, '\nBundling 1 revision.\n')
193
192
 
194
193
    def test_mailto_option(self):
195
194
        b = branch.Branch.open('branch')
296
295
    def set_config_send_strict(self, value):
297
296
        # set config var (any of bazaar.conf, locations.conf, branch.conf
298
297
        # should do)
299
 
        conf = self.local_tree.branch.get_config()
300
 
        conf.set_user_option('send_strict', value)
 
298
        conf = self.local_tree.branch.get_config_stack()
 
299
        conf.set('send_strict', value)
301
300
 
302
301
    def assertSendFails(self, args):
303
302
        out, err = self.run_send(args, rc=3, err_re=self._default_errors)
311
310
        if revs is None:
312
311
            revs = self._default_sent_revs
313
312
        out, err = self.run_send(args, err_re=err_re)
314
 
        bundling_revs = 'Bundling %d revision(s).\n' % len(revs)
 
313
        if len(revs) == 1:
 
314
            bundling_revs = 'Bundling %d revision.\n'% len(revs)
 
315
        else:
 
316
            bundling_revs = 'Bundling %d revisions.\n' % len(revs)
315
317
        if with_warning:
316
318
            self.assertContainsRe(err, self._default_additional_warning)
317
319
            self.assertEndsWith(err, bundling_revs)
436
438
class TestBundleStrictWithoutChanges(TestSendStrictWithoutChanges):
437
439
 
438
440
    _default_command = ['bundle-revisions', '../parent']
 
441
 
 
442
 
 
443
class TestSmartServerSend(tests.TestCaseWithTransport):
 
444
 
 
445
    def test_send(self):
 
446
        self.setup_smart_server_with_call_log()
 
447
        t = self.make_branch_and_tree('branch')
 
448
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
449
        t.add("foo")
 
450
        t.commit("message")
 
451
        local = t.bzrdir.sprout('local-branch').open_workingtree()
 
452
        self.build_tree_contents([('branch/foo', 'thenewcontents')])
 
453
        local.commit("anothermessage")
 
454
        self.reset_smart_call_log()
 
455
        out, err = self.run_bzr(
 
456
            ['send', '-o', 'x.diff', self.get_url('branch')], working_dir='local-branch')
 
457
        # This figure represent the amount of work to perform this use case. It
 
458
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
459
        # being too low. If rpc_count increases, more network roundtrips have
 
460
        # become necessary for this use case. Please do not adjust this number
 
461
        # upwards without agreement from bzr's network support maintainers.
 
462
        self.assertLength(9, self.hpss_calls)
 
463
        self.assertLength(1, self.hpss_connections)
 
464
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)