/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: Jelmer Vernooij
  • Date: 2011-08-16 14:07:34 UTC
  • mto: This revision was merged to the branch mainline in revision 6085.
  • Revision ID: jelmer@samba.org-20110816140734-8n5xockzyav4mjwh
Format URLs in ``bzr upgrade`` before display.

Show diffs side-by-side

added added

removed removed

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