~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        url = get_transport(self.get_url('format_5_branch')).base
102
102
        # check --format takes effect
103
103
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
 
104
        backup_dir = 'backup.bzr.~1~'
104
105
        (out, err) = self.run_bzr(
105
106
            ['upgrade', '--format=metaweave', url])
106
107
        self.assertEqualDiff("""starting upgrade of %s
107
108
making backup of %s.bzr
108
 
  to %sbackup.bzr
 
109
  to %s%s
109
110
starting upgrade from format 5 to 6
110
111
adding prefixes to weaves
111
112
adding prefixes to revision-store
112
113
starting upgrade from format 6 to metadir
113
114
finished
114
 
""" % (url, url, url), out)
 
115
""" % (url, url, url, backup_dir), out)
115
116
        self.assertEqualDiff("", err)
116
117
        self.assertTrue(isinstance(
117
118
            bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
124
125
        url = get_transport(self.get_url('metadir_weave_branch')).base
125
126
        # check --format takes effect
126
127
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
 
128
        backup_dir = 'backup.bzr.~1~'
127
129
        (out, err) = self.run_bzr(
128
130
            ['upgrade', '--format=knit', url])
129
131
        self.assertEqualDiff("""starting upgrade of %s
130
132
making backup of %s.bzr
131
 
  to %sbackup.bzr
 
133
  to %s%s
132
134
starting repository conversion
133
135
repository converted
134
136
finished
135
 
""" % (url, url, url), out)
 
137
""" % (url, url, url, backup_dir), out)
136
138
        self.assertEqualDiff("", err)
137
139
        converted_dir = bzrdir.BzrDir.open(self.get_url('metadir_weave_branch'))
138
140
        self.assertTrue(isinstance(converted_dir._format,
145
147
        self.run_bzr('upgrade --format=knit repo')
146
148
 
147
149
 
 
150
    def test_upgrade_with_existing_backup_dir(self):
 
151
        self.make_format_5_branch()
 
152
        transport = get_transport(self.get_url('format_5_branch'))
 
153
        url = transport.base
 
154
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
 
155
        backup_dir1 = 'backup.bzr.~1~'
 
156
        backup_dir2 = 'backup.bzr.~2~'
 
157
        # explicitly create backup_dir1. bzr should create the .~2~ directory
 
158
        # as backup
 
159
        transport.mkdir(backup_dir1)
 
160
        (out, err) = self.run_bzr(
 
161
            ['upgrade', '--format=metaweave', url])
 
162
        self.assertEqualDiff("""starting upgrade of %s
 
163
making backup of %s.bzr
 
164
  to %s%s
 
165
starting upgrade from format 5 to 6
 
166
adding prefixes to weaves
 
167
adding prefixes to revision-store
 
168
starting upgrade from format 6 to metadir
 
169
finished
 
170
""" % (url, url, url, backup_dir2), out)
 
171
        self.assertEqualDiff("", err)
 
172
        self.assertTrue(isinstance(
 
173
            bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
 
174
            bzrdir.BzrDirMetaFormat1))
 
175
        self.assertTrue(transport.has(backup_dir2))
 
176
 
148
177
class SFTPTests(TestCaseWithSFTPServer):
149
178
    """Tests for upgrade over sftp."""
150
179
 
153
182
        t = get_transport(self.get_url())
154
183
        url = t.base
155
184
        out, err = self.run_bzr(['upgrade', '--format=knit', url])
 
185
        backup_dir = 'backup.bzr.~1~'
156
186
        self.assertEqualDiff("""starting upgrade of %s
157
187
making backup of %s.bzr
158
 
  to %sbackup.bzr
 
188
  to %s%s
159
189
starting upgrade from format 6 to metadir
160
190
starting repository conversion
161
191
repository converted
162
192
finished
163
 
""" % (url, url, url), out)
 
193
""" % (url, url, url,backup_dir), out)
164
194
        self.assertEqual('', err)
165
195
 
166
196