~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Martin Pool
  • Date: 2005-05-19 08:31:06 UTC
  • Revision ID: mbp@sourcefrog.net-20050519083106-ebe71562d3bda4a7
- fix typo

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import osutils
28
28
 
29
29
def check(branch, progress=True):
 
30
    from bzrlib import set
 
31
 
30
32
    out = sys.stdout
31
33
 
32
34
    # TODO: factor out
44
46
 
45
47
    p('history of %r' % branch.base)
46
48
    last_ptr = None
47
 
    checked_revs = {}
 
49
    checked_revs = set()
48
50
    
49
51
    history = branch.revision_history()
50
52
    revno = 0
64
66
        last_ptr = rid
65
67
        if rid in checked_revs:
66
68
            bailout('repeated revision {%s}' % rid)
67
 
        checked_revs[rid] = True
 
69
        checked_revs.add(rid)
68
70
 
69
71
        ## TODO: Check all the required fields are present on the revision.
70
72
 
71
73
        inv = branch.get_inventory(rev.inventory_id)
72
 
        seen_ids = {}
73
 
        seen_names = {}
 
74
        seen_ids = set()
 
75
        seen_names = set()
74
76
 
75
77
        p('revision %d/%d file ids' % (revno, revcount))
76
78
        for file_id in inv:
77
79
            if file_id in seen_ids:
78
80
                bailout('duplicated file_id {%s} in inventory for revision {%s}'
79
81
                        % (file_id, rid))
80
 
            seen_ids[file_id] = True
 
82
            seen_ids.add(file_id)
81
83
 
82
84
        i = 0
83
85
        len_inv = len(inv)
117
119
        for path, ie in inv.iter_entries():
118
120
            if path in seen_names:
119
121
                bailout('duplicated path %r in inventory for revision {%s}' % (path, revid))
120
 
            seen_names[path] = True
 
122
            seen_names.add(path)
121
123
 
122
124
 
123
125
    p('done')