~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib.tests import TestCaseWithTransport
30
30
from bzrlib.tests import (
31
31
    fixtures,
 
32
    HardlinkFeature,
32
33
    script,
33
34
    test_server,
34
35
    )
35
 
from bzrlib.tests.features import (
36
 
    HardlinkFeature,
37
 
    )
38
36
from bzrlib.tests.blackbox import test_switch
39
37
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
40
38
from bzrlib.tests.script import run_script
63
61
        self.assertFalse(b._transport.has('branch-name'))
64
62
        b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True)
65
63
 
66
 
    def test_branch_broken_pack(self):
67
 
        """branching with a corrupted pack file."""
68
 
        self.example_branch('a')
69
 
        # add some corruption
70
 
        packs_dir = 'a/.bzr/repository/packs/'
71
 
        fname = packs_dir + os.listdir(packs_dir)[0]
72
 
        with open(fname, 'rb+') as f:
73
 
            # Start from the end of the file to avoid choosing a place bigger
74
 
            # than the file itself.
75
 
            f.seek(-5, os.SEEK_END)
76
 
            c = f.read(1)
77
 
            f.seek(-5, os.SEEK_END)
78
 
            # Make sure we inject a value different than the one we just read
79
 
            if c == '\xFF':
80
 
                corrupt = '\x00'
81
 
            else:
82
 
                corrupt = '\xFF'
83
 
            f.write(corrupt) # make sure we corrupt something
84
 
        self.run_bzr_error(['Corruption while decompressing repository file'], 
85
 
                            'branch a b', retcode=3)
86
 
 
87
64
    def test_branch_switch_no_branch(self):
88
65
        # No branch in the current directory:
89
66
        #  => new branch will be created, but switch fails
299
276
        builder = self.make_branch_builder('source')
300
277
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
301
278
        source.tags.set_tag('tag-a', 'rev-2')
302
 
        source.get_config().set_user_option('branch.fetch_tags', 'True')
303
279
        # Now source has a tag not in its ancestry.  Make a branch from it.
304
280
        self.run_bzr('branch source new-branch')
305
281
        new_branch = branch.Branch.open('new-branch')
344
320
        # mainline.
345
321
        out, err = self.run_bzr(['branch', 'branch', 'newbranch'])
346
322
        self.assertEqual('', out)
347
 
        self.assertEqual('Branched 2 revisions.\n',
 
323
        self.assertEqual('Branched 2 revision(s).\n',
348
324
            err)
349
325
        # it should have preserved the branch format, and so it should be
350
326
        # capable of supporting stacking, but not actually have a stacked_on
451
427
        # being too low. If rpc_count increases, more network roundtrips have
452
428
        # become necessary for this use case. Please do not adjust this number
453
429
        # upwards without agreement from bzr's network support maintainers.
454
 
        self.assertLength(39, self.hpss_calls)
 
430
        self.assertLength(36, self.hpss_calls)
455
431
 
456
432
    def test_branch_from_trivial_branch_streaming_acceptance(self):
457
433
        self.setup_smart_server_with_call_log()
466
442
        # being too low. If rpc_count increases, more network roundtrips have
467
443
        # become necessary for this use case. Please do not adjust this number
468
444
        # upwards without agreement from bzr's network support maintainers.
469
 
        self.assertLength(10, self.hpss_calls)
 
445
        self.assertLength(9, self.hpss_calls)
470
446
 
471
447
    def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
472
448
        self.setup_smart_server_with_call_log()
486
462
        # being too low. If rpc_count increases, more network roundtrips have
487
463
        # become necessary for this use case. Please do not adjust this number
488
464
        # upwards without agreement from bzr's network support maintainers.
489
 
        self.assertLength(15, self.hpss_calls)
 
465
        self.assertLength(14, self.hpss_calls)
490
466
 
491
467
    def test_branch_from_branch_with_tags(self):
492
468
        self.setup_smart_server_with_call_log()
493
469
        builder = self.make_branch_builder('source')
494
470
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
495
 
        source.get_config().set_user_option('branch.fetch_tags', 'True')
496
471
        source.tags.set_tag('tag-a', 'rev-2')
497
472
        source.tags.set_tag('tag-missing', 'missing-rev')
498
473
        # Now source has a tag not in its ancestry.  Make a branch from it.
503
478
        # being too low. If rpc_count increases, more network roundtrips have
504
479
        # become necessary for this use case. Please do not adjust this number
505
480
        # upwards without agreement from bzr's network support maintainers.
506
 
        self.assertLength(10, self.hpss_calls)
 
481
        self.assertLength(9, self.hpss_calls)
507
482
 
508
483
    def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
509
484
        self.setup_smart_server_with_call_log()
571
546
                $ bzr checkout %(option)s repo/trunk checkout
572
547
                $ cd checkout
573
548
                $ bzr branch --switch ../repo/trunk ../repo/branched
574
 
                2>Branched 0 revisions.
 
549
                2>Branched 0 revision(s).
575
550
                2>Tree is up to date at revision 0.
576
551
                2>Switched to branch:...branched...
577
552
                $ cd ..