~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
from bzrlib.revision import NULL_REVISION
57
57
from bzrlib.trace import note
58
58
from bzrlib.workingtree import WorkingTree
59
 
from bzrlib.i18n import gettext
 
59
 
60
60
 
61
61
class Check(object):
62
62
    """Check a repository"""
103
103
        self.repository.lock_read()
104
104
        self.progress = ui.ui_factory.nested_progress_bar()
105
105
        try:
106
 
            self.progress.update(gettext('check'), 0, 4)
 
106
            self.progress.update('check', 0, 4)
107
107
            if self.check_repo:
108
 
                self.progress.update(gettext('checking revisions'), 0)
 
108
                self.progress.update('checking revisions', 0)
109
109
                self.check_revisions()
110
 
                self.progress.update(gettext('checking commit contents'), 1)
 
110
                self.progress.update('checking commit contents', 1)
111
111
                self.repository._check_inventories(self)
112
 
                self.progress.update(gettext('checking file graphs'), 2)
 
112
                self.progress.update('checking file graphs', 2)
113
113
                # check_weaves is done after the revision scan so that
114
114
                # revision index is known to be valid.
115
115
                self.check_weaves()
116
 
            self.progress.update(gettext('checking branches and trees'), 3)
 
116
            self.progress.update('checking branches and trees', 3)
117
117
            if callback_refs:
118
118
                repo = self.repository
119
119
                # calculate all refs, and callback the objects requesting them.
200
200
            result.report_results(verbose)
201
201
 
202
202
    def _report_repo_results(self, verbose):
203
 
        note(gettext('checked repository {0} format {1}').format(
 
203
        note('checked repository %s format %s',
204
204
            self.repository.user_url,
205
 
            self.repository._format))
206
 
        note(gettext('%6d revisions'), self.checked_rev_cnt)
207
 
        note(gettext('%6d file-ids'), len(self.checked_weaves))
 
205
            self.repository._format)
 
206
        note('%6d revisions', self.checked_rev_cnt)
 
207
        note('%6d file-ids', len(self.checked_weaves))
208
208
        if verbose:
209
 
            note(gettext('%6d unreferenced text versions'),
 
209
            note('%6d unreferenced text versions',
210
210
                len(self.unreferenced_versions))
211
211
        if verbose and len(self.unreferenced_versions):
212
212
                for file_id, revision_id in self.unreferenced_versions:
213
 
                    note(gettext('unreferenced version: {{{0}}} in {1}').format(revision_id,
214
 
                        file_id))
 
213
                    note('unreferenced version: {%s} in %s', revision_id,
 
214
                        file_id)
215
215
        if self.missing_inventory_sha_cnt:
216
 
            note(gettext('%6d revisions are missing inventory_sha1'),
 
216
            note('%6d revisions are missing inventory_sha1',
217
217
                 self.missing_inventory_sha_cnt)
218
218
        if self.missing_revision_cnt:
219
 
            note(gettext('%6d revisions are mentioned but not present'),
 
219
            note('%6d revisions are mentioned but not present',
220
220
                 self.missing_revision_cnt)
221
221
        if len(self.ghosts):
222
 
            note(gettext('%6d ghost revisions'), len(self.ghosts))
 
222
            note('%6d ghost revisions', len(self.ghosts))
223
223
            if verbose:
224
224
                for ghost in self.ghosts:
225
225
                    note('      %s', ghost)
226
226
        if len(self.missing_parent_links):
227
 
            note(gettext('%6d revisions missing parents in ancestry'),
 
227
            note('%6d revisions missing parents in ancestry',
228
228
                 len(self.missing_parent_links))
229
229
            if verbose:
230
230
                for link, linkers in self.missing_parent_links.items():
231
 
                    note(gettext('      %s should be in the ancestry for:'), link)
 
231
                    note('      %s should be in the ancestry for:', link)
232
232
                    for linker in linkers:
233
233
                        note('       * %s', linker)
234
234
        if len(self.inconsistent_parents):
235
 
            note(gettext('%6d inconsistent parents'), len(self.inconsistent_parents))
 
235
            note('%6d inconsistent parents', len(self.inconsistent_parents))
236
236
            if verbose:
237
237
                for info in self.inconsistent_parents:
238
238
                    revision_id, file_id, found_parents, correct_parents = info
239
 
                    note(gettext('      * {0} version {1} has parents {2!r} '
240
 
                         'but should have {3!r}').format(
241
 
                         file_id, revision_id, found_parents,
 
239
                    note('      * %s version %s has parents %r '
 
240
                         'but should have %r'
 
241
                         % (file_id, revision_id, found_parents,
242
242
                             correct_parents))
243
243
        if self.revs_with_bad_parents_in_index:
244
 
            note(gettext(
245
 
                 '%6d revisions have incorrect parents in the revision index'),
 
244
            note('%6d revisions have incorrect parents in the revision index',
246
245
                 len(self.revs_with_bad_parents_in_index))
247
246
            if verbose:
248
247
                for item in self.revs_with_bad_parents_in_index:
249
248
                    revision_id, index_parents, actual_parents = item
250
 
                    note(gettext(
251
 
                        '       {0} has wrong parents in index: '
252
 
                        '{1!r} should be {2!r}').format(
253
 
                        revision_id, index_parents, actual_parents))
 
249
                    note(
 
250
                        '       %s has wrong parents in index: '
 
251
                        '%r should be %r',
 
252
                        revision_id, index_parents, actual_parents)
254
253
        for item in self._report_items:
255
254
            note(item)
256
255
 
261
260
        :param rev: A revision or None to indicate a missing revision.
262
261
        """
263
262
        if rev.revision_id != rev_id:
264
 
            self._report_items.append(gettext(
265
 
                'Mismatched internal revid {{{0}}} and index revid {{{1}}}').format(
 
263
            self._report_items.append(
 
264
                'Mismatched internal revid {%s} and index revid {%s}' % (
266
265
                rev.revision_id, rev_id))
267
266
            rev_id = rev.revision_id
268
267
        # Check this revision tree etc, and count as seen when we encounter a
291
290
        existing = self.pending_keys.get(key)
292
291
        if existing:
293
292
            if sha1 != existing[1]:
294
 
                self._report_items.append(gettext('Multiple expected sha1s for {0}. {{{1}}}'
295
 
                    ' expects {{{2}}}, {{{3}}} expects {{{4}}}').format(
 
293
                self._report_items.append('Multiple expected sha1s for %s. {%s}'
 
294
                    ' expects {%s}, {%s} expects {%s}', (
296
295
                    key, referer, sha1, existing[1], existing[0]))
297
296
        else:
298
297
            self.pending_keys[key] = (kind, sha1, referer)
349
348
    :param needed_refs: Refs we are accumulating.
350
349
    :param to_unlock: The unlock list accumulating.
351
350
    """
352
 
    note(gettext("Checking branch at '%s'.") % (branch.base,))
 
351
    note("Checking branch at '%s'." % (branch.base,))
353
352
    branch.lock_read()
354
353
    to_unlock.append(branch)
355
354
    branch_refs = branch._get_check_refs()
369
368
    """
370
369
    if base_tree is not None and tree.basedir == base_tree.basedir:
371
370
        return
372
 
    note(gettext("Checking working tree at '%s'.") % (tree.basedir,))
 
371
    note("Checking working tree at '%s'." % (tree.basedir,))
373
372
    tree.lock_read()
374
373
    to_unlock.append(tree)
375
374
    tree_refs = tree._get_check_refs()
422
421
                    if do_branch:
423
422
                        scan_branch(branch, needed_refs, to_unlock)
424
423
            if do_branch and not branches:
425
 
                note(gettext("No branch found at specified location."))
 
424
                note("No branch found at specified location.")
426
425
            if do_tree and base_tree is None and not saw_tree:
427
 
                note(gettext("No working tree found at specified location."))
 
426
                note("No working tree found at specified location.")
428
427
            if do_repo or do_branch or do_tree:
429
428
                if do_repo:
430
 
                    note(gettext("Checking repository at '%s'.")
 
429
                    note("Checking repository at '%s'."
431
430
                         % (repo.user_url,))
432
431
                result = repo.check(None, callback_refs=needed_refs,
433
432
                    check_repo=do_repo)
434
433
                result.report_results(verbose)
435
434
        else:
436
435
            if do_tree:
437
 
                note(gettext("No working tree found at specified location."))
 
436
                note("No working tree found at specified location.")
438
437
            if do_branch:
439
 
                note(gettext("No branch found at specified location."))
 
438
                note("No branch found at specified location.")
440
439
            if do_repo:
441
 
                note(gettext("No repository found at specified location."))
 
440
                note("No repository found at specified location.")
442
441
    finally:
443
442
        for thing in to_unlock:
444
443
            thing.unlock()