/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

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
 
from cStringIO import StringIO
20
 
 
21
 
from bzrlib import (
 
19
from ... import (
22
20
    branch,
23
21
    merge_directive,
24
22
    tests,
25
23
    )
26
 
from bzrlib.controldir import ControlDir
27
 
from bzrlib.bundle import serializer
28
 
from bzrlib.transport import memory
29
 
from bzrlib.tests import (
 
24
from ...controldir import ControlDir
 
25
from ...bundle import serializer
 
26
from ...sixish import (
 
27
    BytesIO,
 
28
    )
 
29
from ...transport import memory
 
30
from .. import (
30
31
    scenarios,
31
32
    )
32
 
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
33
from ..matchers import ContainsNoVfsCalls
33
34
 
34
35
 
35
36
load_tests = scenarios.load_tests_apply_scenarios
49
50
                            error_regexes=err_re)
50
51
 
51
52
    def get_MD(self, args, cmd=None, wd='branch'):
52
 
        out = StringIO(self.run_send(args, cmd=cmd, wd=wd)[0])
 
53
        out = BytesIO(self.run_send(args, cmd=cmd, wd=wd)[0])
53
54
        return merge_directive.MergeDirective.from_lines(out)
54
55
 
55
56
    def assertBundleContains(self, revs, args, cmd=None, wd='branch'):
56
57
        md = self.get_MD(args, cmd=cmd, wd=wd)
57
 
        br = serializer.read_bundle(StringIO(md.get_raw_bundle()))
 
58
        br = serializer.read_bundle(BytesIO(md.get_raw_bundle()))
58
59
        self.assertEqual(set(revs), set(r.revision_id for r in br.revisions))
59
60
 
60
61
 
267
268
        location = self.get_url('absentdir/')
268
269
        out, err = self.run_bzr(["send", "--from", location], retcode=3)
269
270
        self.assertEqual(out, '')
270
 
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
 
271
        self.assertEqual(err, 'brz: ERROR: Not a branch: "%s".\n' % location)
271
272
 
272
273
 
273
274
class TestSendStrictMixin(TestSendMixin):
288
289
    _default_wd = 'local'
289
290
    _default_sent_revs = ['local']
290
291
    _default_errors = ['Working tree ".*/local/" has uncommitted '
291
 
                       'changes \(See bzr status\)\.',]
 
292
                       'changes \(See brz status\)\.',]
292
293
    _default_additional_error = 'Use --no-strict to force the send.\n'
293
294
    _default_additional_warning = 'Uncommitted changes will not be sent.'
294
295
 
317
318
            self.assertEndsWith(err, bundling_revs)
318
319
        else:
319
320
            self.assertEqual(bundling_revs, err)
320
 
        md = merge_directive.MergeDirective.from_lines(StringIO(out))
 
321
        md = merge_directive.MergeDirective.from_lines(BytesIO(out))
321
322
        self.assertEqual('parent', md.base_revision_id)
322
 
        br = serializer.read_bundle(StringIO(md.get_raw_bundle()))
 
323
        br = serializer.read_bundle(BytesIO(md.get_raw_bundle()))
323
324
        self.assertEqual(set(revs), set(r.revision_id for r in br.revisions))
324
325
 
325
326
 
402
403
        # Exercise commands from the checkout directory
403
404
        self._default_wd = 'checkout'
404
405
        self._default_errors = ["Working tree is out of date, please run"
405
 
                                " 'bzr update'\.",]
 
406
                                " 'brz update'\.",]
406
407
        self._default_sent_revs = ['modified-in-local', 'local']
407
408
 
408
409
    def test_send_default(self):