/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import os
19
19
import stat
20
20
 
21
 
from breezy import (
22
 
    bzr,
 
21
from bzrlib import (
 
22
    bzrdir,
23
23
    controldir,
24
24
    lockable_files,
25
25
    ui,
26
26
    urlutils,
27
27
    )
28
 
from breezy.bzr import (
29
 
    bzrdir,
30
 
    )
31
 
from breezy.tests import (
 
28
from bzrlib.tests import (
32
29
    features,
33
30
    TestCaseWithTransport,
34
31
    )
35
 
from breezy.tests.test_sftp_transport import TestCaseWithSFTPServer
36
 
from breezy.bzr.knitpack_repo import RepositoryFormatKnitPack1
 
32
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
 
33
from bzrlib.repofmt.knitpack_repo import RepositoryFormatKnitPack1
37
34
 
38
35
 
39
36
class OldBzrDir(bzrdir.BzrDirMeta1):
40
 
    """An test brz dir implementation"""
 
37
    """An test bzr dir implementation"""
41
38
 
42
39
    def needs_format_conversion(self, format):
43
40
        return not isinstance(format, self.__class__)
64
61
 
65
62
    @classmethod
66
63
    def get_format_string(cls):
67
 
        return b"Ancient Test Format"
 
64
        return "Ancient Test Format"
68
65
 
69
66
    def _open(self, transport):
70
67
        return OldBzrDir(transport, self)
86
83
        (out, err) = self.run_bzr(
87
84
            ['upgrade', self.get_readonly_url("old_format_branch")], retcode=3)
88
85
        err_msg = 'Upgrade URL cannot work with readonly URLs.'
89
 
        self.assertEqualDiff('conversion error: %s\nbrz: ERROR: %s\n'
 
86
        self.assertEqualDiff('conversion error: %s\nbzr: ERROR: %s\n'
90
87
                             % (err_msg, err_msg),
91
88
                             err)
92
89
 
131
128
 
132
129
    def test_upgrade_control_dir(self):
133
130
        old_format = OldBzrDirFormat()
134
 
        self.addCleanup(bzr.BzrProber.formats.remove,
 
131
        self.addCleanup(bzrdir.BzrProber.formats.remove,
135
132
            old_format.get_format_string())
136
 
        bzr.BzrProber.formats.register(old_format.get_format_string(),
 
133
        bzrdir.BzrProber.formats.register(old_format.get_format_string(),
137
134
            old_format)
138
135
        self.addCleanup(controldir.ControlDirFormat._set_default_format,
139
136
                        controldir.ControlDirFormat.get_default_format())
201
198
    def assertBranchFormat(self, dir, format):
202
199
        branch = controldir.ControlDir.open_tree_or_branch(self.get_url(dir))[1]
203
200
        branch_format = branch._format
204
 
        meta_format = controldir.format_registry.make_controldir(format)
 
201
        meta_format = controldir.format_registry.make_bzrdir(format)
205
202
        expected_format = meta_format.get_branch_format()
206
203
        self.assertEqual(expected_format, branch_format)
207
204
 
223
220
        self.run_bzr('init --format=1.6')
224
221
        os.chmod('.bzr', old_perms)
225
222
        self.run_bzr('upgrade')
226
 
        new_perms = os.stat(backup_dir).st_mode & 0o777
 
223
        new_perms = os.stat(backup_dir).st_mode & 0777
227
224
        self.assertTrue(new_perms == old_perms)
228
225
 
229
226
    def test_upgrade_with_existing_backup_dir(self):
233
230
        display_url = t.local_abspath('.')
234
231
        backup_dir1 = 'backup.bzr.~1~'
235
232
        backup_dir2 = 'backup.bzr.~2~'
236
 
        # explicitly create backup_dir1. brz should create the .~2~ directory
 
233
        # explicitly create backup_dir1. bzr should create the .~2~ directory
237
234
        # as backup
238
235
        t.mkdir(backup_dir1)
239
236
        (out, err) = self.run_bzr(
279
276
 
280
277
    def test_recommend_upgrade_wt4(self):
281
278
        # using a deprecated format gives a warning
282
 
        self.run_bzr('init --format=knit a')
 
279
        self.run_bzr('init --knit a')
283
280
        out, err = self.run_bzr('status a')
284
 
        self.assertContainsRe(err, 'brz upgrade .*[/\\\\]a')
 
281
        self.assertContainsRe(err, 'bzr upgrade .*[/\\\\]a')
285
282
 
286
283
    def test_no_upgrade_recommendation_from_bzrdir(self):
287
284
        # we should only get a recommendation to upgrade when we're accessing
288
285
        # the actual workingtree, not when we only open a bzrdir that contains
289
286
        # an old workngtree
290
 
        self.run_bzr('init --format=knit a')
 
287
        self.run_bzr('init --knit a')
291
288
        out, err = self.run_bzr('revno a')
292
289
        if err.find('upgrade') > -1:
293
290
            self.fail("message shouldn't suggest upgrade:\n%s" % err)