~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Martin Pool
  • Date: 2005-05-12 02:14:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050512021435-87fa19f051842647
- new helper function kind_marker()

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import sys
24
24
from sets import Set
25
25
 
26
 
import bzrlib
27
26
from trace import mutter
28
27
from errors import bailout
29
28
import osutils
31
30
def check(branch, progress=True):
32
31
    out = sys.stdout
33
32
 
 
33
    # TODO: factor out
 
34
    if not (hasattr(out, 'isatty') and out.isatty()):
 
35
        progress=False
 
36
 
34
37
    if progress:
35
38
        def p(m):
36
39
            mutter('checking ' + m)
74
77
        for file_id in inv:
75
78
            if file_id in seen_ids:
76
79
                bailout('duplicated file_id {%s} in inventory for revision {%s}'
77
 
                        % (file_id, revid))
 
80
                        % (file_id, rid))
78
81
            seen_ids.add(file_id)
79
82
 
80
83
        i = 0
89
92
            if ie.parent_id != None:
90
93
                if ie.parent_id not in seen_ids:
91
94
                    bailout('missing parent {%s} in inventory for revision {%s}'
92
 
                            % (ie.parent_id, revid))
 
95
                            % (ie.parent_id, rid))
93
96
 
94
97
            if ie.kind == 'file':
95
98
                if ie.text_id in checked_texts:
109
112
            elif ie.kind == 'directory':
110
113
                if ie.text_sha1 != None or ie.text_size != None or ie.text_id != None:
111
114
                    bailout('directory {%s} has text in revision {%s}'
112
 
                            % (file_id, revid))
 
115
                            % (file_id, rid))
113
116
 
114
117
        p('revision %d/%d file paths' % (revno, revcount))
115
118
        for path, ie in inv.iter_entries():
121
124
    p('done')
122
125
    if progress:
123
126
        print 
124
 
 
 
127
    print 'checked %d revisions, %d file texts' % (revcount, len(checked_texts))
125
128