~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.tests import (
31
31
    fixtures,
32
32
    HardlinkFeature,
33
 
    script,
34
33
    test_server,
35
34
    )
36
 
from bzrlib.tests.blackbox import test_switch
37
35
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
38
36
from bzrlib.tests.script import run_script
39
37
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
61
59
        self.assertFalse(b._transport.has('branch-name'))
62
60
        b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True)
63
61
 
64
 
    def test_branch_broken_pack(self):
65
 
        """branching with a corrupted pack file."""
66
 
        self.example_branch('a')
67
 
        #now add some random corruption
68
 
        fname = 'a/.bzr/repository/packs/' + os.listdir('a/.bzr/repository/packs')[0]
69
 
        with open(fname, 'rb+') as f:
70
 
            f.seek(750)
71
 
            f.write("\xff")
72
 
        self.run_bzr_error(['Corruption while decompressing repository file'], 
73
 
                            'branch a b', retcode=3)
74
 
 
75
62
    def test_branch_switch_no_branch(self):
76
63
        # No branch in the current directory:
77
64
        #  => new branch will be created, but switch fails
491
478
        # upwards without agreement from bzr's network support maintainers.
492
479
        self.assertLength(9, self.hpss_calls)
493
480
 
494
 
    def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
495
 
        self.setup_smart_server_with_call_log()
496
 
        t = self.make_branch_and_tree('from')
497
 
        for count in range(9):
498
 
            t.commit(message='commit %d' % count)
499
 
        self.reset_smart_call_log()
500
 
        out, err = self.run_bzr(['branch', '--stacked', self.get_url('from'),
501
 
            'local-target'])
502
 
        # XXX: the number of hpss calls for this case isn't deterministic yet,
503
 
        # so we can't easily assert about the number of calls.
504
 
        #self.assertLength(XXX, self.hpss_calls)
505
 
        # We can assert that none of the calls were readv requests for rix
506
 
        # files, though (demonstrating that at least get_parent_map calls are
507
 
        # not using VFS RPCs).
508
 
        readvs_of_rix_files = [
509
 
            c for c in self.hpss_calls
510
 
            if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')]
511
 
        self.assertLength(0, readvs_of_rix_files)
512
 
 
513
481
 
514
482
class TestRemoteBranch(TestCaseWithSFTPServer):
515
483
 
548
516
            2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead.
549
517
            2>bzr: ERROR: Not a branch...
550
518
            """ % locals())
551
 
 
552
 
 
553
 
class TestBranchParentLocation(test_switch.TestSwitchParentLocationBase):
554
 
 
555
 
    def _checkout_and_branch(self, option=''):
556
 
        self.script_runner.run_script(self, '''
557
 
                $ bzr checkout %(option)s repo/trunk checkout
558
 
                $ cd checkout
559
 
                $ bzr branch --switch ../repo/trunk ../repo/branched
560
 
                2>Branched 0 revision(s).
561
 
                2>Tree is up to date at revision 0.
562
 
                2>Switched to branch:...branched...
563
 
                $ cd ..
564
 
                ''' % locals())
565
 
        bound_branch = branch.Branch.open_containing('checkout')[0]
566
 
        master_branch = branch.Branch.open_containing('repo/branched')[0]
567
 
        return (bound_branch, master_branch)
568
 
 
569
 
    def test_branch_switch_parent_lightweight(self):
570
 
        """Lightweight checkout using bzr branch --switch."""
571
 
        bb, mb = self._checkout_and_branch(option='--lightweight')
572
 
        self.assertParent('repo/trunk', bb)
573
 
        self.assertParent('repo/trunk', mb)
574
 
 
575
 
    def test_branch_switch_parent_heavyweight(self):
576
 
        """Heavyweight checkout using bzr branch --switch."""
577
 
        bb, mb = self._checkout_and_branch()
578
 
        self.assertParent('repo/trunk', bb)
579
 
        self.assertParent('repo/trunk', mb)