~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(jameinel) Make kind markers optional for bzr status. (Martin von Gagern)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    controldir,
24
24
    lockable_files,
25
25
    ui,
26
 
    urlutils,
27
26
    )
28
27
from bzrlib.tests import (
29
28
    features,
101
100
        # when upgrading a checkout, the branch location and a suggestion
102
101
        # to upgrade it should be emitted even if the checkout is up to
103
102
        # date
104
 
        burl = self.get_transport('current_format_branch').local_abspath(".")
105
 
        curl = self.get_transport('current_format_checkout').local_abspath(".")
 
103
        burl = self.get_transport('current_format_branch').base
 
104
        curl = self.get_transport('current_format_checkout').base
106
105
        (out, err) = self.run_bzr('upgrade current_format_checkout', retcode=3)
107
106
        self.assertEqual(
108
 
            'Upgrading branch %s/ ...\nThis is a checkout.'
109
 
            ' The branch (%s/) needs to be upgraded separately.\n'
 
107
            'Upgrading branch %s ...\nThis is a checkout.'
 
108
            ' The branch (%s) needs to be upgraded separately.\n'
110
109
            % (curl, burl),
111
110
            out)
112
111
        msg = 'The branch format %s is already at the most recent format.' % (
140
139
        # setup an old format branch we can upgrade from.
141
140
        path = 'old_format_branch'
142
141
        self.make_branch_and_tree(path, format=old_format)
143
 
        transport = self.get_transport(path)
144
 
        url = transport.base
145
 
        display_url = transport.local_abspath('.')
 
142
        url = self.get_transport(path).base
146
143
        # check --format takes effect
147
144
        controldir.ControlDirFormat._set_default_format(old_format)
148
145
        backup_dir = 'backup.bzr.~1~'
149
146
        (out, err) = self.run_bzr(
150
147
            ['upgrade', '--format=2a', url])
151
 
        self.assertEqualDiff("""Upgrading branch %s/ ...
152
 
starting upgrade of %s/
153
 
making backup of %s/.bzr
154
 
  to %s/%s
 
148
        self.assertEqualDiff("""Upgrading branch %s ...
 
149
starting upgrade of %s
 
150
making backup of %s.bzr
 
151
  to %s%s
155
152
starting upgrade from old test format to 2a
156
153
finished
157
 
""" % (display_url, display_url, display_url, display_url, backup_dir), out)
 
154
""" % (url, url, url, url, backup_dir), out)
158
155
        self.assertEqualDiff("", err)
159
156
        self.assertTrue(isinstance(
160
157
            bzrdir.BzrDir.open(self.get_url(path))._format,
164
161
        # users can force an upgrade to knit format from a metadir pack 0.92
165
162
        # branch to a 2a branch.
166
163
        self.make_branch_and_tree('branch', format='knit')
167
 
        transport = self.get_transport('branch')
168
 
        url = transport.base
169
 
        display_url = transport.local_abspath('.')
 
164
        url = self.get_transport('branch').base
170
165
        # check --format takes effect
171
166
        backup_dir = 'backup.bzr.~1~'
172
167
        (out, err) = self.run_bzr(
173
168
            ['upgrade', '--format=pack-0.92', url])
174
 
        self.assertEqualDiff("""Upgrading branch %s/ ...
175
 
starting upgrade of %s/
176
 
making backup of %s/.bzr
177
 
  to %s/%s
 
169
        self.assertEqualDiff("""Upgrading branch %s ...
 
170
starting upgrade of %s
 
171
making backup of %s.bzr
 
172
  to %s%s
178
173
starting repository conversion
179
174
repository converted
180
175
finished
181
 
""" % (display_url, display_url, display_url, display_url, backup_dir),
 
176
""" % (url, url, url, url, backup_dir),
182
177
                             out)
183
178
        self.assertEqualDiff("", err)
184
179
        converted_dir = bzrdir.BzrDir.open(self.get_url('branch'))
229
224
        self.make_branch_and_tree("old_format_branch", format="knit")
230
225
        t = self.get_transport("old_format_branch")
231
226
        url = t.base
232
 
        display_url = t.local_abspath('.')
233
227
        backup_dir1 = 'backup.bzr.~1~'
234
228
        backup_dir2 = 'backup.bzr.~2~'
235
229
        # explicitly create backup_dir1. bzr should create the .~2~ directory
237
231
        t.mkdir(backup_dir1)
238
232
        (out, err) = self.run_bzr(
239
233
            ['upgrade', '--format=2a', url])
240
 
        self.assertEqualDiff("""Upgrading branch %s/ ...
241
 
starting upgrade of %s/
242
 
making backup of %s/.bzr
243
 
  to %s/%s
 
234
        self.assertEqualDiff("""Upgrading branch %s ...
 
235
starting upgrade of %s
 
236
making backup of %s.bzr
 
237
  to %s%s
244
238
starting repository conversion
245
239
repository converted
246
240
finished
247
 
""" % (display_url, display_url, display_url, display_url, backup_dir2), out)
 
241
""" % (url, url, url, url, backup_dir2), out)
248
242
        self.assertEqualDiff("", err)
249
243
        self.assertTrue(isinstance(
250
244
            bzrdir.BzrDir.open(self.get_url("old_format_branch"))._format,
259
253
        self.run_bzr('init --format=pack-0.92')
260
254
        t = self.get_transport()
261
255
        url = t.base
262
 
        display_url = urlutils.unescape_for_display(url,
263
 
            'utf-8')
264
256
        out, err = self.run_bzr(['upgrade', '--format=2a', url])
265
257
        backup_dir = 'backup.bzr.~1~'
266
258
        self.assertEqualDiff("""Upgrading branch %s ...
270
262
starting repository conversion
271
263
repository converted
272
264
finished
273
 
""" % (display_url, display_url, display_url, display_url, backup_dir), out)
 
265
""" % (url, url, url, url,backup_dir), out)
274
266
        self.assertEqual('', err)
275
267
 
276
268