/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

build_tree_contents can create symlinks

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:
51
 
                ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
52
 
                             "upgraded separately." %
53
 
                             branch.user_url)
 
53
            if branch.bzrdir.root_transport.base != \
 
54
                self.bzrdir.root_transport.base:
 
55
                self.pb.note("This is a checkout. The branch (%s) needs to be "
 
56
                             "upgraded separately.",
 
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.
74
78
            raise errors.BzrError("cannot upgrade from bzrdir format %s" %
75
79
                           self.bzrdir._format)
76
80
        self.bzrdir.check_conversion_target(format)
77
 
        ui.ui_factory.note('starting upgrade of %s' % self.transport.base)
78
 
 
 
81
        self.pb.note('starting upgrade of %s', self.transport.base)
79
82
        self.bzrdir.backup_bzrdir()
80
83
        while self.bzrdir.needs_format_conversion(format):
81
84
            converter = self.bzrdir._format.get_converter(format)
82
 
            self.bzrdir = converter.convert(self.bzrdir, None)
83
 
        ui.ui_factory.note("finished")
 
85
            self.bzrdir = converter.convert(self.bzrdir, self.pb)
 
86
        self.pb.note("finished")
84
87
 
85
88
 
86
89
def upgrade(url, format=None):