~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2006-02-25 00:49:18 UTC
  • mto: (1587.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1588.
  • Revision ID: robertc@robertcollins.net-20060225004918-13fe7b4b532c606c
Do not throttle updates to progress bars that change the message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# change upgrade from .bzr to create a '.bzr-new', then do a bait and switch.
20
20
 
21
21
 
22
 
from bzrlib.bzrdir import ConvertBzrDir4To5, ConvertBzrDir5To6, BzrDir, BzrDirFormat4, BzrDirFormat5, BzrDirFormat
 
22
from bzrlib.bzrdir import ConvertBzrDir4To5, ConvertBzrDir5To6, BzrDir, BzrDirFormat4, BzrDirFormat5
23
23
import bzrlib.errors as errors
24
24
from bzrlib.transport import get_transport
25
25
import bzrlib.ui as ui
33
33
        if self.bzrdir.root_transport.is_readonly():
34
34
            raise errors.UpgradeReadonly
35
35
        self.transport = self.bzrdir.root_transport
36
 
        self.pb = ui.ui_factory.nested_progress_bar()
37
 
        try:
38
 
            self.convert()
39
 
        finally:
40
 
            self.pb.finished()
 
36
        self.convert()
41
37
 
42
38
    def convert(self):
43
 
        try:
44
 
            branch = self.bzrdir.open_branch()
45
 
            if branch.bzrdir.root_transport.base != \
46
 
                self.bzrdir.root_transport.base:
47
 
                self.pb.note("This is a checkout. The branch (%s) needs to be "
48
 
                             "upgraded separately.",
49
 
                             branch.bzrdir.root_transport.base)
50
 
        except errors.NotBranchError:
51
 
            pass
 
39
        self.pb = ui.ui_factory.progress_bar()
 
40
        branch = self.bzrdir.open_branch()
 
41
        if branch.bzrdir.root_transport.base != self.bzrdir.root_transport.base:
 
42
            self.pb.note("This is a checkout. The branch (%s) needs to be "
 
43
                         "upgraded separately.",
 
44
                         branch.bzrdir.root_transport.base)
52
45
        if not self.bzrdir.needs_format_conversion(self.format):
53
46
            raise errors.UpToDateFormat(self.bzrdir._format)
54
47
        if not self.bzrdir.can_convert_format():
55
48
            raise errors.BzrError("cannot upgrade from branch format %s" %
56
49
                           self.bzrdir._format)
57
 
        if self.format is None:
58
 
            target_format = BzrDirFormat.get_default_format()
59
 
        else:
60
 
            target_format = self.format
61
 
        self.bzrdir.check_conversion_target(target_format)
62
50
        self.pb.note('starting upgrade of %s', self.transport.base)
63
51
        self._backup_control_dir()
64
52
        while self.bzrdir.needs_format_conversion(self.format):