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
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'
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)
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
152
self.assertEqualDiff("""Upgrading branch %s/ ...
153
starting upgrade of %s/
154
making backup of %s/.bzr
152
156
starting upgrade from old test format to 2a
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')
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
175
self.assertEqualDiff("""Upgrading branch %s/ ...
176
starting upgrade of %s/
177
making backup of %s/.bzr
173
179
starting repository conversion
174
180
repository converted
176
""" % (url, url, url, url, backup_dir),
182
""" % (display_url, display_url, display_url, display_url, backup_dir),
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")
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
241
self.assertEqualDiff("""Upgrading branch %s/ ...
242
starting upgrade of %s/
243
making backup of %s/.bzr
238
245
starting repository conversion
239
246
repository converted
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()
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
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)