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
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'
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)
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
148
self.assertEqualDiff("""Upgrading branch %s ...
149
starting upgrade of %s
150
making backup of %s.bzr
155
152
starting upgrade from old test format to 2a
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')
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
169
self.assertEqualDiff("""Upgrading branch %s ...
170
starting upgrade of %s
171
making backup of %s.bzr
178
173
starting repository conversion
179
174
repository converted
181
""" % (display_url, display_url, display_url, display_url, backup_dir),
176
""" % (url, url, url, url, backup_dir),
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")
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
234
self.assertEqualDiff("""Upgrading branch %s ...
235
starting upgrade of %s
236
making backup of %s.bzr
244
238
starting repository conversion
245
239
repository converted
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()
262
display_url = urlutils.unescape_for_display(url,
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
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)