~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    def __init__(self, url, format=None):
29
29
        self.format = format
30
30
        self.bzrdir = BzrDir.open_unsupported(url)
31
 
        # XXX: Change to cleanup
32
 
        warning_id = 'cross_format_fetch'
33
 
        saved_warning = warning_id in ui.ui_factory.suppressed_warnings
34
31
        if isinstance(self.bzrdir, RemoteBzrDir):
35
32
            self.bzrdir._ensure_real()
36
33
            self.bzrdir = self.bzrdir._real_bzrdir
37
34
        if self.bzrdir.root_transport.is_readonly():
38
35
            raise errors.UpgradeReadonly
39
36
        self.transport = self.bzrdir.root_transport
40
 
        ui.ui_factory.suppressed_warnings.add(warning_id)
41
 
        try:
42
 
            self.convert()
43
 
        finally:
44
 
            if not saved_warning:
45
 
                ui.ui_factory.suppressed_warnings.remove(warning_id)
 
37
        self.convert()
46
38
 
47
39
    def convert(self):
48
40
        try:
49
41
            branch = self.bzrdir.open_branch()
50
 
            if branch.user_url != self.bzrdir.user_url:
 
42
            if branch.bzrdir.root_transport.base != \
 
43
                self.bzrdir.root_transport.base:
51
44
                ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
52
45
                             "upgraded separately." %
53
 
                             branch.user_url)
 
46
                             branch.bzrdir.root_transport.base)
54
47
            del branch
55
48
        except (errors.NotBranchError, errors.IncompatibleRepositories):
56
49
            # might not be a format we can open without upgrading; see e.g.