~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2006-02-16 08:51:52 UTC
  • mto: (1534.1.24 integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060216085152-d0311d8efd0c654c
Make upgrade driver unaware of the specific formats in play.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
            self.pb.note("This is a checkout. The branch (%s) needs to be "
42
42
                         "upgraded separately.",
43
43
                         branch.bzrdir.root_transport.base)
 
44
        if not self.bzrdir.needs_format_update():
 
45
            raise errors.UpToDateFormat(self.bzrdir._format)
44
46
        if not self.bzrdir.can_update_format():
45
47
            raise errors.BzrError("cannot upgrade from branch format %s" %
46
48
                           self.bzrdir._format)
47
 
        if not self.bzrdir.needs_format_update():
48
 
            raise errors.UpToDateFormat(self.bzrdir._format)
49
49
        self.pb.note('starting upgrade of %s', self.transport.base)
50
50
        self._backup_control_dir()
 
51
        while self.bzrdir.needs_format_update():
 
52
            converter = self.bzrdir._format.get_updater()
 
53
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
51
54
        if isinstance(self.bzrdir._format, BzrDirFormat4):
52
 
            converter = ConvertBzrDir4To5(self.bzrdir, self.pb)
53
 
            self.bzrdir = converter.convert()
 
55
            converter = ConvertBzrDir4To5()
 
56
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
54
57
        if isinstance(self.bzrdir._format, BzrDirFormat5):
55
 
            converter = ConvertBzrDir5To6(self.bzrdir, self.pb)
56
 
            self.bzrdir = converter.convert()
 
58
            converter = ConvertBzrDir5To6()
 
59
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
57
60
        self.pb.note("finished")
58
61
 
59
62
    def _backup_control_dir(self):