~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2009-01-16 02:18:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3945.
  • Revision ID: mbp@sourcefrog.net-20090116021855-tpv7k2calih400cu
Small refactoring to upgrade

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008 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
27
27
class Convert(object):
28
28
 
29
29
    def __init__(self, url, format):
 
30
        if format is None:
 
31
            format = BzrDirFormat.get_default_format()
30
32
        self.format = format
31
33
        self.bzrdir = BzrDir.open_unsupported(url)
32
34
        if isinstance(self.bzrdir, RemoteBzrDir):
59
61
        if not self.bzrdir.can_convert_format():
60
62
            raise errors.BzrError("cannot upgrade from bzrdir format %s" %
61
63
                           self.bzrdir._format)
62
 
        if self.format is None:
63
 
            target_format = BzrDirFormat.get_default_format()
64
 
        else:
65
 
            target_format = self.format
66
 
        self.bzrdir.check_conversion_target(target_format)
 
64
        self.bzrdir.check_conversion_target(self.format)
67
65
        self.pb.note('starting upgrade of %s', self.transport.base)
68
66
        self._backup_control_dir()
69
67
        while self.bzrdir.needs_format_conversion(self.format):