/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

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
    def make_format_5_branch(self):
50
50
        # setup a format 5 branch we can upgrade from.
51
 
        self.make_branch_and_tree('format_5_branch',
52
 
                                  format=bzrdir.BzrDirFormat5())
 
51
        path = 'format_5_branch'
 
52
        self.make_branch_and_tree(path, format=bzrdir.BzrDirFormat5())
 
53
        return path
53
54
 
54
55
    def make_metadir_weave_branch(self):
55
56
        self.make_branch_and_tree('metadir_weave_branch', format='metaweave')
56
57
 
57
58
    def test_readonly_url_error(self):
58
 
        self.make_format_5_branch()
 
59
        path = self.make_format_5_branch()
59
60
        (out, err) = self.run_bzr(
60
 
            ['upgrade', self.get_readonly_url('format_5_branch')], retcode=3)
 
61
            ['upgrade', self.get_readonly_url(path)], retcode=3)
61
62
        err_msg = 'Upgrade URL cannot work with readonly URLs.'
62
63
        self.assertEqualDiff('conversion error: %s\nbzr: ERROR: %s\n'
63
64
                             % (err_msg, err_msg),
101
102
        # anonymous branch
102
103
        pass
103
104
 
104
 
    def test_ugrade_branch_in_repo(self):
 
105
    def test_upgrade_branch_in_repo(self):
105
106
        # upgrading a branch in a repo should warn about not upgrading the repo
106
107
        pass
107
108
 
108
109
    def test_upgrade_explicit_metaformat(self):
109
110
        # users can force an upgrade to metadir format.
110
 
        self.make_format_5_branch()
111
 
        url = transport.get_transport(self.get_url('format_5_branch')).base
 
111
        path = self.make_format_5_branch()
 
112
        url = self.get_transport(path).base
112
113
        # check --format takes effect
113
114
        controldir.ControlDirFormat._set_default_format(bzrdir.BzrDirFormat5())
114
115
        backup_dir = 'backup.bzr.~1~'
126
127
""" % (url, url, url, url, backup_dir), out)
127
128
        self.assertEqualDiff("", err)
128
129
        self.assertTrue(isinstance(
129
 
            bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
 
130
            bzrdir.BzrDir.open(self.get_url(path))._format,
130
131
            bzrdir.BzrDirMetaFormat1))
131
132
 
132
133
    def test_upgrade_explicit_knit(self):
133
134
        # users can force an upgrade to knit format from a metadir weave
134
135
        # branch
135
136
        self.make_metadir_weave_branch()
136
 
        url = transport.get_transport(self.get_url('metadir_weave_branch')).base
 
137
        url = self.get_transport('metadir_weave_branch').base
137
138
        # check --format takes effect
138
139
        controldir.ControlDirFormat._set_default_format(bzrdir.BzrDirFormat5())
139
140
        backup_dir = 'backup.bzr.~1~'
193
194
        new_perms = os.stat(backup_dir).st_mode & 0777
194
195
        self.assertTrue(new_perms == old_perms)
195
196
 
196
 
 
197
197
    def test_upgrade_with_existing_backup_dir(self):
198
 
        self.make_format_5_branch()
199
 
        t = transport.get_transport(self.get_url('format_5_branch'))
 
198
        path = self.make_format_5_branch()
 
199
        t = self.get_transport(path)
200
200
        url = t.base
201
201
        controldir.ControlDirFormat._set_default_format(bzrdir.BzrDirFormat5())
202
202
        backup_dir1 = 'backup.bzr.~1~'
218
218
""" % (url, url, url, url, backup_dir2), out)
219
219
        self.assertEqualDiff("", err)
220
220
        self.assertTrue(isinstance(
221
 
            bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
 
221
            bzrdir.BzrDir.open(self.get_url(path))._format,
222
222
            bzrdir.BzrDirMetaFormat1))
223
223
        self.assertTrue(t.has(backup_dir2))
224
224
 
 
225
 
225
226
class SFTPTests(TestCaseWithSFTPServer):
226
227
    """Tests for upgrade over sftp."""
227
228
 
228
229
    def test_upgrade_url(self):
229
230
        self.run_bzr('init --format=weave')
230
 
        t = transport.get_transport(self.get_url())
 
231
        t = self.get_transport()
231
232
        url = t.base
232
233
        out, err = self.run_bzr(['upgrade', '--format=knit', url])
233
234
        backup_dir = 'backup.bzr.~1~'