~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconcile.py

(jr) Add gettext() to uses of note() (Jonathan Riddell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
from bzrlib.trace import mutter
36
36
from bzrlib.tsort import topo_sort
37
37
from bzrlib.versionedfile import AdapterFactory, FulltextContentFactory
 
38
from bzrlib.i18n import gettext
38
39
 
39
40
 
40
41
def reconcile(dir, canonicalize_chks=False):
92
93
            # Nothing to check here
93
94
            self.fixed_branch_history = None
94
95
            return
95
 
        ui.ui_factory.note('Reconciling branch %s' % self.branch.base)
 
96
        ui.ui_factory.note(gettext('Reconciling branch %s') % self.branch.base)
96
97
        branch_reconciler = self.branch.reconcile(thorough=True)
97
98
        self.fixed_branch_history = branch_reconciler.fixed_history
98
99
 
99
100
    def _reconcile_repository(self):
100
101
        self.repo = self.bzrdir.find_repository()
101
 
        ui.ui_factory.note('Reconciling repository %s' %
 
102
        ui.ui_factory.note(gettext('Reconciling repository %s') %
102
103
            self.repo.user_url)
103
 
        self.pb.update("Reconciling repository", 0, 1)
 
104
        self.pb.update(gettext("Reconciling repository"), 0, 1)
104
105
        if self.canonicalize_chks:
105
106
            try:
106
107
                self.repo.reconcile_canonicalize_chks
107
108
            except AttributeError:
108
109
                raise errors.BzrError(
109
 
                    "%s cannot canonicalize CHKs." % (self.repo,))
 
110
                    gettext("%s cannot canonicalize CHKs.") % (self.repo,))
110
111
            repo_reconciler = self.repo.reconcile_canonicalize_chks()
111
112
        else:
112
113
            repo_reconciler = self.repo.reconcile(thorough=True)
113
114
        self.inconsistent_parents = repo_reconciler.inconsistent_parents
114
115
        self.garbage_inventories = repo_reconciler.garbage_inventories
115
116
        if repo_reconciler.aborted:
116
 
            ui.ui_factory.note(
117
 
                'Reconcile aborted: revision index has inconsistent parents.')
118
 
            ui.ui_factory.note(
119
 
                'Run "bzr check" for more details.')
 
117
            ui.ui_factory.note(gettext(
 
118
                'Reconcile aborted: revision index has inconsistent parents.'))
 
119
            ui.ui_factory.note(gettext(
 
120
                'Run "bzr check" for more details.'))
120
121
        else:
121
 
            ui.ui_factory.note('Reconciliation complete.')
 
122
            ui.ui_factory.note(gettext('Reconciliation complete.'))
122
123
 
123
124
 
124
125
class BranchReconciler(object):
161
162
            # set_revision_history, as this will regenerate it again.
162
163
            # Not really worth a whole BranchReconciler class just for this,
163
164
            # though.
164
 
            ui.ui_factory.note('Fixing last revision info %s => %s' % (
 
165
            ui.ui_factory.note(gettext('Fixing last revision info %s => %s') % (
165
166
                 last_revno, len(real_history)))
166
167
            self.branch.set_last_revision_info(len(real_history),
167
168
                                               last_revision_id)
168
169
        else:
169
170
            self.fixed_history = False
170
 
            ui.ui_factory.note('revision_history ok.')
 
171
            ui.ui_factory.note(gettext('revision_history ok.'))
171
172
 
172
173
 
173
174
class RepoReconciler(object):
228
229
        (self.thorough) are treated as requiring the reweave.
229
230
        """
230
231
        transaction = self.repo.get_transaction()
231
 
        self.pb.update('Reading inventory data')
 
232
        self.pb.update(gettext('Reading inventory data'))
232
233
        self.inventory = self.repo.inventories
233
234
        self.revisions = self.repo.revisions
234
235
        # the total set of revisions to process
248
249
        # (no garbage inventories or we are not doing a thorough check)
249
250
        if (not self.inconsistent_parents and
250
251
            (not self.garbage_inventories or not self.thorough)):
251
 
            ui.ui_factory.note('Inventory ok.')
 
252
            ui.ui_factory.note(gettext('Inventory ok.'))
252
253
            return
253
 
        self.pb.update('Backing up inventory', 0, 0)
 
254
        self.pb.update(gettext('Backing up inventory'), 0, 0)
254
255
        self.repo._backup_inventory()
255
 
        ui.ui_factory.note('Backup inventory created.')
 
256
        ui.ui_factory.note(gettext('Backup inventory created.'))
256
257
        new_inventories = self.repo._temp_inventories()
257
258
 
258
259
        # we have topological order of revisions and non ghost parents ready.
268
269
        if not (set(new_inventories.keys()) ==
269
270
            set([(revid,) for revid in self.pending])):
270
271
            raise AssertionError()
271
 
        self.pb.update('Writing weave')
 
272
        self.pb.update(gettext('Writing weave'))
272
273
        self.repo._activate_new_inventory()
273
274
        self.inventory = None
274
 
        ui.ui_factory.note('Inventory regenerated.')
 
275
        ui.ui_factory.note(gettext('Inventory regenerated.'))
275
276
 
276
277
    def _new_inv_parents(self, revision_key):
277
278
        """Lookup ghost-filtered parents for revision_key."""
365
366
    def _load_indexes(self):
366
367
        """Load indexes for the reconciliation."""
367
368
        self.transaction = self.repo.get_transaction()
368
 
        self.pb.update('Reading indexes', 0, 2)
 
369
        self.pb.update(gettext('Reading indexes'), 0, 2)
369
370
        self.inventory = self.repo.inventories
370
 
        self.pb.update('Reading indexes', 1, 2)
 
371
        self.pb.update(gettext('Reading indexes'), 1, 2)
371
372
        self.repo._check_for_inconsistent_revision_parents()
372
373
        self.revisions = self.repo.revisions
373
 
        self.pb.update('Reading indexes', 2, 2)
 
374
        self.pb.update(gettext('Reading indexes'), 2, 2)
374
375
 
375
376
    def _gc_inventory(self):
376
377
        """Remove inventories that are not referenced from the revision store."""
377
 
        self.pb.update('Checking unused inventories', 0, 1)
 
378
        self.pb.update(gettext('Checking unused inventories'), 0, 1)
378
379
        self._check_garbage_inventories()
379
 
        self.pb.update('Checking unused inventories', 1, 3)
 
380
        self.pb.update(gettext('Checking unused inventories'), 1, 3)
380
381
        if not self.garbage_inventories:
381
 
            ui.ui_factory.note('Inventory ok.')
 
382
            ui.ui_factory.note(gettext('Inventory ok.'))
382
383
            return
383
 
        self.pb.update('Backing up inventory', 0, 0)
 
384
        self.pb.update(gettext('Backing up inventory'), 0, 0)
384
385
        self.repo._backup_inventory()
385
 
        ui.ui_factory.note('Backup Inventory created')
 
386
        ui.ui_factory.note(gettext('Backup Inventory created'))
386
387
        # asking for '' should never return a non-empty weave
387
388
        new_inventories = self.repo._temp_inventories()
388
389
        # we have topological order of revisions and non ghost parents ready.
399
400
        # the revisionds list
400
401
        if not(set(new_inventories.keys()) == set(revision_keys)):
401
402
            raise AssertionError()
402
 
        self.pb.update('Writing weave')
 
403
        self.pb.update(gettext('Writing weave'))
403
404
        self.repo._activate_new_inventory()
404
405
        self.inventory = None
405
 
        ui.ui_factory.note('Inventory regenerated.')
 
406
        ui.ui_factory.note(gettext('Inventory regenerated.'))
406
407
 
407
408
    def _fix_text_parents(self):
408
409
        """Fix bad versionedfile parent entries.
440
441
            versions_list.append(text_key[1])
441
442
        # Do the reconcile of individual weaves.
442
443
        for num, file_id in enumerate(per_id_bad_parents):
443
 
            self.pb.update('Fixing text parents', num,
 
444
            self.pb.update(gettext('Fixing text parents'), num,
444
445
                           len(per_id_bad_parents))
445
446
            versions_with_bad_parents = per_id_bad_parents[file_id]
446
447
            id_unused_versions = set(key[-1] for key in unused_versions