~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 16:38:10 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309163810-ujn8hcx08f75nlf1
Refined test to make use of locking hooks and also validate if lock is truly a checkout-lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
  indicating that the revision was found/not found.
47
47
"""
48
48
 
49
 
from bzrlib import errors
 
49
from bzrlib import errors, osutils
 
50
from bzrlib import repository as _mod_repository
 
51
from bzrlib import revision
50
52
from bzrlib.branch import Branch
51
53
from bzrlib.bzrdir import BzrDir
 
54
from bzrlib.errors import BzrCheckError
 
55
from bzrlib.repository import Repository
52
56
from bzrlib.revision import NULL_REVISION
53
57
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
54
 
from bzrlib.trace import note
 
58
from bzrlib.trace import log_error, note
55
59
import bzrlib.ui
56
60
from bzrlib.workingtree import WorkingTree
57
61
 
188
192
 
189
193
    def _report_repo_results(self, verbose):
190
194
        note('checked repository %s format %s',
191
 
            self.repository.user_url,
192
 
            self.repository._format)
 
195
             self.repository.bzrdir.root_transport,
 
196
             self.repository._format)
193
197
        note('%6d revisions', self.checked_rev_cnt)
194
198
        note('%6d file-ids', len(self.checked_weaves))
195
199
        if verbose:
197
201
                len(self.unreferenced_versions))
198
202
        if verbose and len(self.unreferenced_versions):
199
203
                for file_id, revision_id in self.unreferenced_versions:
200
 
                    note('unreferenced version: {%s} in %s', revision_id,
 
204
                    log_error('unreferenced version: {%s} in %s', revision_id,
201
205
                        file_id)
202
206
        if self.missing_inventory_sha_cnt:
203
207
            note('%6d revisions are missing inventory_sha1',
441
445
                    if do_branch:
442
446
                        scan_branch(branch, needed_refs, to_unlock)
443
447
            if do_branch and not branches:
444
 
                note("No branch found at specified location.")
 
448
                log_error("No branch found at specified location.")
445
449
            if do_tree and base_tree is None and not saw_tree:
446
 
                note("No working tree found at specified location.")
 
450
                log_error("No working tree found at specified location.")
447
451
            if do_repo or do_branch or do_tree:
448
452
                if do_repo:
449
453
                    note("Checking repository at '%s'."
450
 
                         % (repo.user_url,))
 
454
                         % (repo.bzrdir.root_transport.base,))
451
455
                result = repo.check(None, callback_refs=needed_refs,
452
456
                    check_repo=do_repo)
453
457
                result.report_results(verbose)
454
458
        else:
455
459
            if do_tree:
456
 
                note("No working tree found at specified location.")
 
460
                log_error("No working tree found at specified location.")
457
461
            if do_branch:
458
 
                note("No branch found at specified location.")
 
462
                log_error("No branch found at specified location.")
459
463
            if do_repo:
460
 
                note("No repository found at specified location.")
 
464
                log_error("No repository found at specified location.")
461
465
    finally:
462
466
        for thing in to_unlock:
463
467
            thing.unlock()