~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2011-10-09 13:52:06 UTC
  • mfrom: (6202.1.3 revno-revision)
  • Revision ID: pqm@pqm.ubuntu.com-20111009135206-t3utsln6mtzv9eut
(jelmer) Add a --revision argument to 'bzr revno'. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

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