~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2007-04-28 15:04:17 UTC
  • mfrom: (2466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2566.
  • Revision ID: john@arbash-meinel.com-20070428150417-trp3pi0pzd411pu4
[merge] bzr.dev 2466

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        bzrdir.BzrDirFormat._set_default_format(self.old_format)
62
62
 
63
63
    def test_readonly_url_error(self):
64
 
        (out, err) = self.run_bzr(
65
 
            ['upgrade', self.get_readonly_url('format_5_branch')], retcode=3)
 
64
        (out, err) = self.run_bzr_captured(
 
65
            ['upgrade', self.get_readonly_url('format_5_branch')], 3)
66
66
        self.assertEqual(out, "")
67
67
        self.assertEqual(err, "bzr: ERROR: Upgrade URL cannot work with readonly URLs.\n")
68
68
 
69
69
    def test_upgrade_up_to_date(self):
70
70
        # when up to date we should get a message to that effect
71
 
        (out, err) = self.run_bzr('upgrade current_format_branch', retcode=3)
 
71
        (out, err) = self.run_bzr_captured(
 
72
            ['upgrade', 'current_format_branch'], 3)
72
73
        self.assertEqual("", out)
73
74
        self.assertEqualDiff("bzr: ERROR: The branch format Bazaar-NG meta "
74
75
                             "directory, format 1 is already at the most "
78
79
        # when upgrading a checkout, the branch location and a suggestion
79
80
        # to upgrade it should be emitted even if the checkout is up to 
80
81
        # date
81
 
        (out, err) = self.run_bzr('upgrade current_format_checkout', retcode=3)
 
82
        (out, err) = self.run_bzr_captured(
 
83
            ['upgrade', 'current_format_checkout'], 3)
82
84
        self.assertEqual("This is a checkout. The branch (%s) needs to be "
83
 
                         "upgraded separately.\n"
 
85
                         "upgraded separately.\n" 
84
86
                         % get_transport(self.get_url('current_format_branch')).base,
85
87
                         out)
86
88
        self.assertEqualDiff("bzr: ERROR: The branch format Bazaar-NG meta "
105
107
        url = get_transport(self.get_url('format_5_branch')).base
106
108
        # check --format takes effect
107
109
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
108
 
        (out, err) = self.run_bzr(
 
110
        (out, err) = self.run_bzr_captured(
109
111
            ['upgrade', '--format=metaweave', url])
110
112
        self.assertEqualDiff("""starting upgrade of %s
111
113
making backup of tree history
112
 
%s.bzr has been backed up to %sbackup.bzr
 
114
%s.bzr has been backed up to %s.bzr.backup
113
115
if conversion fails, you can move this directory back to .bzr
114
116
if it succeeds, you can remove this directory if you wish
115
117
starting upgrade from format 5 to 6
129
131
        url = get_transport(self.get_url('metadir_weave_branch')).base
130
132
        # check --format takes effect
131
133
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
132
 
        (out, err) = self.run_bzr(
 
134
        (out, err) = self.run_bzr_captured(
133
135
            ['upgrade', '--format=knit', url])
134
136
        self.assertEqualDiff("""starting upgrade of %s
135
137
making backup of tree history
136
 
%s.bzr has been backed up to %sbackup.bzr
 
138
%s.bzr has been backed up to %s.bzr.backup
137
139
if conversion fails, you can move this directory back to .bzr
138
140
if it succeeds, you can remove this directory if you wish
139
141
starting repository conversion
148
150
                                   RepositoryFormatKnit1))
149
151
 
150
152
    def test_upgrade_repo(self):
151
 
        self.run_bzr('init-repository --format=metaweave repo')
152
 
        self.run_bzr('upgrade --format=knit repo')
 
153
        self.run_bzr('init-repository', '--format=metaweave', 'repo')
 
154
        self.run_bzr('upgrade', '--format=knit', 'repo')
153
155
 
154
156
 
155
157
class SFTPTests(TestCaseWithSFTPServer):
166
168
        ui.ui_factory = self.old_ui_factory
167
169
 
168
170
    def test_upgrade_url(self):
169
 
        self.run_bzr('init --format=weave')
 
171
        self.run_bzr('init', '--format=weave')
170
172
        t = get_transport(self.get_url())
171
173
        url = t.base
172
 
        out, err = self.run_bzr(['upgrade', '--format=knit', url])
 
174
        out, err = self.run_bzr('upgrade', '--format=knit', url)
173
175
        self.assertEqualDiff("""starting upgrade of %s
174
176
making backup of tree history
175
 
%s.bzr has been backed up to %sbackup.bzr
 
177
%s.bzr has been backed up to %s.bzr.backup
176
178
if conversion fails, you can move this directory back to .bzr
177
179
if it succeeds, you can remove this directory if you wish
178
180
starting upgrade from format 6 to metadir
187
189
 
188
190
    def test_recommend_upgrade_wt4(self):
189
191
        # using a deprecated format gives a warning
190
 
        self.run_bzr('init --knit a')
191
 
        out, err = self.run_bzr('status a')
 
192
        self.run_bzr('init', '--knit', 'a')
 
193
        out, err = self.run_bzr('status', 'a')
192
194
        self.assertContainsRe(err, 'bzr upgrade .*[/\\\\]a')
193
195
 
194
196
    def test_no_upgrade_recommendation_from_bzrdir(self):
195
197
        # we should only get a recommendation to upgrade when we're accessing
196
198
        # the actual workingtree, not when we only open a bzrdir that contains
197
199
        # an old workngtree
198
 
        self.run_bzr('init --knit a')
199
 
        out, err = self.run_bzr('revno a')
 
200
        self.run_bzr('init', '--knit', 'a')
 
201
        out, err = self.run_bzr('checkout', 'a', 'b')
200
202
        if err.find('upgrade') > -1:
201
203
            self.fail("message shouldn't suggest upgrade:\n%s" % err)