~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-08 11:01:15 UTC
  • mfrom: (6123.1.16 gpg-typo)
  • Revision ID: pqm@cupuasso-20110908110115-gbb9benwkdksvzk5
(jelmer) Fix a typo (invalid format identifier) in an error message in
 bzrlib.gpg. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    BzrDir,
28
28
    format_registry,
29
29
    )
30
 
from bzrlib.i18n import gettext
31
30
from bzrlib.remote import RemoteBzrDir
32
31
 
33
32
 
72
71
        try:
73
72
            branch = self.bzrdir.open_branch()
74
73
            if branch.user_url != self.bzrdir.user_url:
75
 
                ui.ui_factory.note(gettext(
 
74
                ui.ui_factory.note(
76
75
                    'This is a checkout. The branch (%s) needs to be upgraded'
77
 
                    ' separately.') % (urlutils.unescape_for_display(
 
76
                    ' separately.' % (urlutils.unescape_for_display(
78
77
                        branch.user_url, 'utf-8')))
79
78
            del branch
80
79
        except (errors.NotBranchError, errors.IncompatibleRepositories):
96
95
        if not self.bzrdir.needs_format_conversion(format):
97
96
            raise errors.UpToDateFormat(self.bzrdir._format)
98
97
        if not self.bzrdir.can_convert_format():
99
 
            raise errors.BzrError(gettext("cannot upgrade from bzrdir format %s") %
 
98
            raise errors.BzrError("cannot upgrade from bzrdir format %s" %
100
99
                           self.bzrdir._format)
101
100
        self.bzrdir.check_conversion_target(format)
102
 
        ui.ui_factory.note(gettext('starting upgrade of %s') % 
 
101
        ui.ui_factory.note('starting upgrade of %s' % 
103
102
            urlutils.unescape_for_display(self.transport.base, 'utf-8'))
104
103
 
105
104
        self.backup_oldpath, self.backup_newpath = self.bzrdir.backup_bzrdir()
106
105
        while self.bzrdir.needs_format_conversion(format):
107
106
            converter = self.bzrdir._format.get_converter(format)
108
107
            self.bzrdir = converter.convert(self.bzrdir, None)
109
 
        ui.ui_factory.note(gettext('finished'))
 
108
        ui.ui_factory.note('finished')
110
109
 
111
110
    def clean_up(self):
112
111
        """Clean-up after a conversion.
116
115
        transport = self.transport
117
116
        backup_relpath = transport.relpath(self.backup_newpath)
118
117
        child_pb = ui.ui_factory.nested_progress_bar()
119
 
        child_pb.update(gettext('Deleting backup.bzr'))
 
118
        child_pb.update('Deleting backup.bzr')
120
119
        try:
121
120
            transport.delete_tree(backup_relpath)
122
121
        finally:
147
146
        succeeded_count = len(succeeded)
148
147
        failed_count = attempted_count - succeeded_count
149
148
        ui.ui_factory.note(
150
 
            gettext('\nSUMMARY: {0} upgrades attempted, {1} succeeded,'\
151
 
                    ' {2} failed').format(
152
 
                     attempted_count, succeeded_count, failed_count))
 
149
            '\nSUMMARY: %d upgrades attempted, %d succeeded, %d failed'
 
150
            % (attempted_count, succeeded_count, failed_count))
153
151
    return exceptions
154
152
 
155
153
 
204
202
    succeeded, exceptions = _convert_items([control_dir], format, clean_up,
205
203
                                           dry_run)
206
204
    if succeeded and dependents:
207
 
        ui.ui_factory.note(gettext('Found %d dependent branches - upgrading ...')
 
205
        ui.ui_factory.note('Found %d dependent branches - upgrading ...'
208
206
                           % (len(dependents),))
209
207
        # Convert dependent branches
210
208
        branch_cdirs = [b.bzrdir for b in dependents]
272
270
    succeeded = []
273
271
    exceptions = []
274
272
    child_pb = ui.ui_factory.nested_progress_bar()
275
 
    child_pb.update(gettext('Upgrading bzrdirs'), 0, len(items))
 
273
    child_pb.update('Upgrading bzrdirs', 0, len(items))
276
274
    for i, control_dir in enumerate(items):
277
275
        # Do the conversion
278
276
        location = control_dir.root_transport.base
279
277
        bzr_object, bzr_label = _get_object_and_label(control_dir)
280
278
        type_label = label or bzr_label
281
 
        child_pb.update(gettext("Upgrading %s") % (type_label), i+1, len(items))
282
 
        ui.ui_factory.note(gettext('Upgrading {0} {1} ...').format(type_label, 
 
279
        child_pb.update("Upgrading %s" % (type_label), i+1, len(items))
 
280
        ui.ui_factory.note('Upgrading %s %s ...' % (type_label, 
283
281
            urlutils.unescape_for_display(location, 'utf-8'),))
284
282
        try:
285
283
            if not dry_run:
293
291
        succeeded.append(control_dir)
294
292
        if clean_up:
295
293
            try:
296
 
                ui.ui_factory.note(gettext('Removing backup ...'))
 
294
                ui.ui_factory.note('Removing backup ...')
297
295
                if not dry_run:
298
296
                    cv.clean_up()
299
297
            except Exception, ex:
300
 
                trace.warning(gettext('failed to clean-up {0}: {1}') % (location, ex))
 
298
                trace.warning('failed to clean-up %s: %s' % (location, ex))
301
299
                exceptions.append(ex)
302
300
 
303
301
    child_pb.finished()