/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-02 19:05:34 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050702190534-5d151ec01dbcfbc0
Moving the validation into part of the reading.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
            f = open(filename, 'U')
105
105
 
106
106
        cset_info, cset_tree = read_changeset.read_changeset(f, b)
107
 
        #print cset_info
108
 
        #print cset_tree
109
 
 
110
 
        failed = False
111
 
        rev_to_sha = {}
112
 
        def add_sha(rev_id, sha1):
113
 
            if rev_id in rev_to_sha:
114
 
                # This really should have been validated as part
115
 
                # of read_changeset, but lets do it again
116
 
                if sha1 != rev_to_sha[rev_id]:
117
 
                    print ('** Revision %r referenced with 2 different'
118
 
                            ' sha hashes %s != %s' % (rev_id,
119
 
                                sha1, rev_to_sha[rev_id]))
120
 
                    failed = True
121
 
            else:
122
 
                rev_to_sha[rev_id] = sha1
123
 
 
124
 
        for rev_info in cset_info.revisions:
125
 
            add_sha(rev_info.rev_id, rev_info.sha1)
126
 
                
127
 
        for rev in cset_info.real_revisions:
128
 
            for parent in rev.parents:
129
 
                add_sha(parent.revision_id, parent.revision_sha1)
130
 
 
131
 
        missing = {}
132
 
        for rev_id, sha1 in rev_to_sha.iteritems():
133
 
            if rev_id in b.revision_store:
134
 
                local_sha1 = b.get_revision_sha1(rev_id)
135
 
                if sha1 != local_sha1:
136
 
                    print '** sha1 mismatch. For revision_id {%s}' % rev_id
137
 
                    print '**     local: %s' % local_sha1
138
 
                    print '** changeset: %s' % sha1
139
 
                    failed = True
140
 
            else:
141
 
                missing[rev_id] = sha1
142
 
        
143
 
        # Entries in missing do not exist in the local branch,
144
 
        # so we cannot validate them.
145
 
        if len(missing) > 0:
146
 
            print '** Unable to verify %d checksums' % len(missing)
147
 
 
148
 
        if failed:
149
 
            print '** Changeset did not validate.'
150
 
        else:
151
 
            print 'Changeset is valid'
152
 
            print 'validated %d revision sha hashes.' % (len(rev_to_sha) - len(missing))
 
107
        print cset_info
 
108
        print cset_tree
 
109
 
153
110
 
154
111
 
155
112
class cmd_apply_changeset(bzrlib.commands.Command):