104
104
f = open(filename, 'U')
106
106
cset_info, cset_tree = read_changeset.read_changeset(f, b)
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]))
122
rev_to_sha[rev_id] = sha1
124
for rev_info in cset_info.revisions:
125
add_sha(rev_info.rev_id, rev_info.sha1)
127
for rev in cset_info.real_revisions:
128
for parent in rev.parents:
129
add_sha(parent.revision_id, parent.revision_sha1)
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
141
missing[rev_id] = sha1
143
# Entries in missing do not exist in the local branch,
144
# so we cannot validate them.
146
print '** Unable to verify %d checksums' % len(missing)
149
print '** Changeset did not validate.'
151
print 'Changeset is valid'
152
print 'validated %d revision sha hashes.' % (len(rev_to_sha) - len(missing))
155
112
class cmd_apply_changeset(bzrlib.commands.Command):