~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2011-09-08 11:01:15 UTC
  • mfrom: (6123.1.16 gpg-typo)
  • Revision ID: pqm@cupuasso-20110908110115-gbb9benwkdksvzk5
(jelmer) Fix a typo (invalid format identifier) in an error message in
 bzrlib.gpg. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    def test_branch_broken_pack(self):
67
67
        """branching with a corrupted pack file."""
68
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]
 
69
        #now add some random corruption
 
70
        fname = 'a/.bzr/repository/packs/' + os.listdir('a/.bzr/repository/packs')[0]
72
71
        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
 
72
            f.seek(750)
 
73
            f.write("\xff")
84
74
        self.run_bzr_error(['Corruption while decompressing repository file'], 
85
75
                            'branch a b', retcode=3)
86
76
 
344
334
        # mainline.
345
335
        out, err = self.run_bzr(['branch', 'branch', 'newbranch'])
346
336
        self.assertEqual('', out)
347
 
        self.assertEqual('Branched 2 revisions.\n',
 
337
        self.assertEqual('Branched 2 revision(s).\n',
348
338
            err)
349
339
        # it should have preserved the branch format, and so it should be
350
340
        # capable of supporting stacking, but not actually have a stacked_on
451
441
        # being too low. If rpc_count increases, more network roundtrips have
452
442
        # become necessary for this use case. Please do not adjust this number
453
443
        # upwards without agreement from bzr's network support maintainers.
454
 
        self.assertLength(39, self.hpss_calls)
 
444
        self.assertLength(37, self.hpss_calls)
455
445
 
456
446
    def test_branch_from_trivial_branch_streaming_acceptance(self):
457
447
        self.setup_smart_server_with_call_log()
571
561
                $ bzr checkout %(option)s repo/trunk checkout
572
562
                $ cd checkout
573
563
                $ bzr branch --switch ../repo/trunk ../repo/branched
574
 
                2>Branched 0 revisions.
 
564
                2>Branched 0 revision(s).
575
565
                2>Tree is up to date at revision 0.
576
566
                2>Switched to branch:...branched...
577
567
                $ cd ..