~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2006-04-18 05:08:30 UTC
  • mto: (1711.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1668.
  • Revision ID: robertc@robertcollins.net-20060418050830-ec8a43605cbc2b32
Fix and test upgrades from bzrdir 6 over SFTP.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import bzrlib.repository as repository
25
25
from bzrlib.tests import TestCaseWithTransport
26
26
from bzrlib.tests.blackbox import TestUIFactory
 
27
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
27
28
from bzrlib.transport import get_transport
28
29
import bzrlib.ui as ui
29
30
 
149
150
    def test_upgrade_repo(self):
150
151
        self.run_bzr('init-repository', '--format=metadir', 'repo')
151
152
        self.run_bzr('upgrade', '--format=knit', 'repo')
 
153
 
 
154
 
 
155
class SFTPTests(TestCaseWithSFTPServer):
 
156
    """Tests for upgrade over sftp."""
 
157
 
 
158
    def setUp(self):
 
159
        super(SFTPTests, self).setUp()
 
160
        self.old_ui_factory = ui.ui_factory
 
161
        self.addCleanup(self.restoreDefaults)
 
162
 
 
163
        ui.ui_factory = TestUIFactory()
 
164
 
 
165
    def restoreDefaults(self):
 
166
        ui.ui_factory = self.old_ui_factory
 
167
 
 
168
    def test_upgrade_url(self):
 
169
        self.run_bzr('init', '--format=weave')
 
170
        t = get_transport(self.get_url())
 
171
        url = t.base
 
172
        out, err = self.run_bzr('upgrade', '--format=knit', url)
 
173
        self.assertEqualDiff("""starting upgrade of %s
 
174
making backup of tree history
 
175
%s.bzr has been backed up to %s.bzr.backup
 
176
if conversion fails, you can move this directory back to .bzr
 
177
if it succeeds, you can remove this directory if you wish
 
178
starting upgrade from format 6 to metadir
 
179
starting repository conversion
 
180
repository converted
 
181
finished
 
182
""" % (url, url, url), out)
 
183
        self.assertEqual('', err)