/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: Robert Collins
  • Date: 2006-02-16 08:18:32 UTC
  • mto: (1534.1.24 integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060216081832-4ef742424a888da0
Advise users running upgrade on a checkout to also run it on the branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import bzrlib.bzrdir as bzrdir
24
24
from bzrlib.tests import TestCaseWithTransport
25
25
from bzrlib.transport import get_transport
 
26
import bzrlib.ui as ui
 
27
 
 
28
 
 
29
class TestUIFactory(ui.UIFactory):
 
30
    """A UI Factory which never captures its output.
 
31
    """
 
32
 
 
33
    def note(self, fmt_string, *args, **kwargs):
 
34
        """See progress.ProgressBae.note()."""
 
35
        print fmt_string % args
 
36
 
 
37
    def progress_bar(self):
 
38
        return self
26
39
 
27
40
 
28
41
class TestWithUpgradableBranches(TestCaseWithTransport):
30
43
    def setUp(self):
31
44
        super(TestWithUpgradableBranches, self).setUp()
32
45
        self.old_format = bzrdir.BzrDirFormat.get_default_format()
33
 
        self.addCleanup(self.restoreDefaultFormat)
 
46
        self.old_ui_factory = ui.ui_factory
 
47
        self.addCleanup(self.restoreDefaults)
 
48
 
 
49
        ui.ui_factory = TestUIFactory()
34
50
        bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
35
51
        # FIXME RBC 20060120 we should be able to do this via ui calls only.
36
52
        # setup a format 5 branch we can upgrade from.
38
54
        t.mkdir('format_5_branch')
39
55
        bzrdir.BzrDirFormat5().initialize(self.get_url('format_5_branch'))
40
56
        bzrdir.BzrDir.create_standalone_workingtree('current_format_branch')
 
57
        self.run_bzr('checkout',
 
58
                     self.get_url('current_format_branch'),
 
59
                     'current_format_checkout')
41
60
 
42
 
    def restoreDefaultFormat(self):
 
61
    def restoreDefaults(self):
43
62
        bzrdir.BzrDirFormat.set_default_format(self.old_format)
 
63
        ui.ui_factory = self.old_ui_factory
44
64
 
45
65
    def test_readonly_url_error(self):
46
66
        (out, err) = self.run_bzr_captured(
61
81
        # when upgrading a checkout, the branch location and a suggestion
62
82
        # to upgrade it should be emitted even if the checkout is up to 
63
83
        # date
64
 
        pass
 
84
        (out, err) = self.run_bzr_captured(
 
85
            ['upgrade', 'current_format_checkout'], 3)
 
86
        self.assertEqual("This is a checkout. The branch (%s) needs to be "
 
87
                         "upgraded separately.\n" 
 
88
                         % get_transport(self.get_url('current_format_branch')).base,
 
89
                         out)
 
90
        self.assertEqualDiff("bzr: ERROR: The branch format Bazaar-NG meta "
 
91
                             "directory, format 1 is already at the most "
 
92
                             "recent format.\n", err)
65
93
 
66
94
    def test_upgrade_checkout(self):
67
95
        # upgrading a checkout should work