~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-11 09:27:55 UTC
  • mfrom: (5017.3.46 test-servers)
  • mto: This revision was merged to the branch mainline in revision 5030.
  • Revision ID: v.ladeuil+lp@free.fr-20100211092755-3vvu4vbwiwjjte3s
Move tests servers from bzrlib.transport to bzrlib.tests.test_server

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
35
35
        if self.bzrdir.root_transport.is_readonly():
36
36
            raise errors.UpgradeReadonly
37
37
        self.transport = self.bzrdir.root_transport
38
 
        self.pb = ui.ui_factory.nested_progress_bar()
39
 
        try:
40
 
            self.convert()
41
 
        finally:
42
 
            self.pb.finished()
 
38
        self.convert()
43
39
 
44
40
    def convert(self):
45
41
        try:
46
42
            branch = self.bzrdir.open_branch()
47
43
            if branch.bzrdir.root_transport.base != \
48
44
                self.bzrdir.root_transport.base:
49
 
                self.pb.note("This is a checkout. The branch (%s) needs to be "
50
 
                             "upgraded separately.",
 
45
                ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
 
46
                             "upgraded separately." %
51
47
                             branch.bzrdir.root_transport.base)
52
48
            del branch
53
49
        except (errors.NotBranchError, errors.IncompatibleRepositories):
72
68
            raise errors.BzrError("cannot upgrade from bzrdir format %s" %
73
69
                           self.bzrdir._format)
74
70
        self.bzrdir.check_conversion_target(format)
75
 
        self.pb.note('starting upgrade of %s', self.transport.base)
 
71
        ui.ui_factory.note('starting upgrade of %s' % self.transport.base)
 
72
 
76
73
        self.bzrdir.backup_bzrdir()
77
74
        while self.bzrdir.needs_format_conversion(format):
78
75
            converter = self.bzrdir._format.get_converter(format)
79
 
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
80
 
        self.pb.note("finished")
 
76
            self.bzrdir = converter.convert(self.bzrdir, None)
 
77
        ui.ui_factory.note("finished")
81
78
 
82
79
 
83
80
def upgrade(url, format=None):