~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bzr.dev to unify _type_equality_funcs workarounds

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,
33
32
    script,
34
33
    test_server,
35
34
    )
 
35
from bzrlib.tests.features import (
 
36
    HardlinkFeature,
 
37
    )
36
38
from bzrlib.tests.blackbox import test_switch
37
39
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
38
40
from bzrlib.tests.script import run_script
61
63
        self.assertFalse(b._transport.has('branch-name'))
62
64
        b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True)
63
65
 
 
66
    def test_branch_broken_pack(self):
 
67
        """branching with a corrupted pack file."""
 
68
        self.example_branch('a')
 
69
        #now add some random corruption
 
70
        fname = 'a/.bzr/repository/packs/' + os.listdir('a/.bzr/repository/packs')[0]
 
71
        with open(fname, 'rb+') as f:
 
72
            f.seek(750)
 
73
            f.write("\xff")
 
74
        self.run_bzr_error(['Corruption while decompressing repository file'], 
 
75
                            'branch a b', retcode=3)
 
76
 
64
77
    def test_branch_switch_no_branch(self):
65
78
        # No branch in the current directory:
66
79
        #  => new branch will be created, but switch fails
276
289
        builder = self.make_branch_builder('source')
277
290
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
278
291
        source.tags.set_tag('tag-a', 'rev-2')
 
292
        source.get_config().set_user_option('branch.fetch_tags', 'True')
279
293
        # Now source has a tag not in its ancestry.  Make a branch from it.
280
294
        self.run_bzr('branch source new-branch')
281
295
        new_branch = branch.Branch.open('new-branch')
427
441
        # being too low. If rpc_count increases, more network roundtrips have
428
442
        # become necessary for this use case. Please do not adjust this number
429
443
        # upwards without agreement from bzr's network support maintainers.
430
 
        self.assertLength(36, self.hpss_calls)
 
444
        self.assertLength(37, self.hpss_calls)
431
445
 
432
446
    def test_branch_from_trivial_branch_streaming_acceptance(self):
433
447
        self.setup_smart_server_with_call_log()
442
456
        # being too low. If rpc_count increases, more network roundtrips have
443
457
        # become necessary for this use case. Please do not adjust this number
444
458
        # upwards without agreement from bzr's network support maintainers.
445
 
        self.assertLength(9, self.hpss_calls)
 
459
        self.assertLength(10, self.hpss_calls)
446
460
 
447
461
    def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
448
462
        self.setup_smart_server_with_call_log()
462
476
        # being too low. If rpc_count increases, more network roundtrips have
463
477
        # become necessary for this use case. Please do not adjust this number
464
478
        # upwards without agreement from bzr's network support maintainers.
465
 
        self.assertLength(14, self.hpss_calls)
 
479
        self.assertLength(15, self.hpss_calls)
466
480
 
467
481
    def test_branch_from_branch_with_tags(self):
468
482
        self.setup_smart_server_with_call_log()
469
483
        builder = self.make_branch_builder('source')
470
484
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
 
485
        source.get_config().set_user_option('branch.fetch_tags', 'True')
471
486
        source.tags.set_tag('tag-a', 'rev-2')
472
487
        source.tags.set_tag('tag-missing', 'missing-rev')
473
488
        # Now source has a tag not in its ancestry.  Make a branch from it.
478
493
        # being too low. If rpc_count increases, more network roundtrips have
479
494
        # become necessary for this use case. Please do not adjust this number
480
495
        # upwards without agreement from bzr's network support maintainers.
481
 
        self.assertLength(9, self.hpss_calls)
 
496
        self.assertLength(10, self.hpss_calls)
482
497
 
483
498
    def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
484
499
        self.setup_smart_server_with_call_log()