Show More
@@ -175,6 +175,17 b' class local(object):' | |||||
175 | _verify(oid, blob) |
|
175 | _verify(oid, blob) | |
176 | return blob |
|
176 | return blob | |
177 |
|
177 | |||
|
178 | def verify(self, oid): | |||
|
179 | """Indicate whether or not the hash of the underlying file matches its | |||
|
180 | name.""" | |||
|
181 | sha256 = hashlib.sha256() | |||
|
182 | ||||
|
183 | with self.open(oid) as fp: | |||
|
184 | for chunk in util.filechunkiter(fp, size=1048576): | |||
|
185 | sha256.update(chunk) | |||
|
186 | ||||
|
187 | return oid == sha256.hexdigest() | |||
|
188 | ||||
178 | def has(self, oid): |
|
189 | def has(self, oid): | |
179 | """Returns True if the local blobstore contains the requested blob, |
|
190 | """Returns True if the local blobstore contains the requested blob, | |
180 | False otherwise.""" |
|
191 | False otherwise.""" |
General Comments 0
You need to be logged in to leave comments.
Login now