~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Sidnei da Silva
  • Date: 2009-05-29 14:19:29 UTC
  • mto: (4531.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4532.
  • Revision ID: sidnei.da.silva@canonical.com-20090529141929-3heywbvj36po72a5
- Add initial config

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2008, 2009 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.convert()
 
38
        self.pb = ui.ui_factory.nested_progress_bar()
 
39
        try:
 
40
            self.convert()
 
41
        finally:
 
42
            self.pb.finished()
39
43
 
40
44
    def convert(self):
41
45
        try:
42
46
            branch = self.bzrdir.open_branch()
43
47
            if branch.bzrdir.root_transport.base != \
44
48
                self.bzrdir.root_transport.base:
45
 
                ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
46
 
                             "upgraded separately." %
 
49
                self.pb.note("This is a checkout. The branch (%s) needs to be "
 
50
                             "upgraded separately.",
47
51
                             branch.bzrdir.root_transport.base)
48
52
            del branch
49
53
        except (errors.NotBranchError, errors.IncompatibleRepositories):
68
72
            raise errors.BzrError("cannot upgrade from bzrdir format %s" %
69
73
                           self.bzrdir._format)
70
74
        self.bzrdir.check_conversion_target(format)
71
 
        ui.ui_factory.note('starting upgrade of %s' % self.transport.base)
72
 
 
 
75
        self.pb.note('starting upgrade of %s', self.transport.base)
73
76
        self.bzrdir.backup_bzrdir()
74
77
        while self.bzrdir.needs_format_conversion(format):
75
78
            converter = self.bzrdir._format.get_converter(format)
76
 
            self.bzrdir = converter.convert(self.bzrdir, None)
77
 
        ui.ui_factory.note("finished")
 
79
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
 
80
        self.pb.note("finished")
78
81
 
79
82
 
80
83
def upgrade(url, format=None):