/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

Merge 2.0 into 2.1 resolving conflicts

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, 2010 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
17
17
"""bzr upgrade logic."""
18
18
 
19
19
 
20
 
from bzrlib.bzrdir import BzrDir, format_registry
 
20
from bzrlib.bzrdir import BzrDir, BzrDirFormat, format_registry
21
21
import bzrlib.errors as errors
22
22
from bzrlib.remote import RemoteBzrDir
 
23
from bzrlib.transport import get_transport
23
24
import bzrlib.ui as ui
24
25
 
25
26
 
37
38
        if self.bzrdir.root_transport.is_readonly():
38
39
            raise errors.UpgradeReadonly
39
40
        self.transport = self.bzrdir.root_transport
 
41
        self.pb = ui.ui_factory.nested_progress_bar()
40
42
        ui.ui_factory.suppressed_warnings.add(warning_id)
41
43
        try:
42
44
            self.convert()
43
45
        finally:
 
46
            self.pb.finished()
44
47
            if not saved_warning:
45
48
                ui.ui_factory.suppressed_warnings.remove(warning_id)
46
49
 
47
50
    def convert(self):
48
51
        try:
49
52
            branch = self.bzrdir.open_branch()
50
 
            if branch.user_url != self.bzrdir.user_url:
 
53
            if branch.bzrdir.root_transport.base != \
 
54
                self.bzrdir.root_transport.base:
51
55
                ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
52
56
                             "upgraded separately." %
53
 
                             branch.user_url)
 
57
                             branch.bzrdir.root_transport.base)
54
58
            del branch
55
59
        except (errors.NotBranchError, errors.IncompatibleRepositories):
56
60
            # might not be a format we can open without upgrading; see e.g.
79
83
        self.bzrdir.backup_bzrdir()
80
84
        while self.bzrdir.needs_format_conversion(format):
81
85
            converter = self.bzrdir._format.get_converter(format)
82
 
            self.bzrdir = converter.convert(self.bzrdir, None)
 
86
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
83
87
        ui.ui_factory.note("finished")
84
88
 
85
89