Show More
@@ -316,8 +316,9 b' class _gitlfsremote(object):' | |||||
316 | request = util.urlreq.request(href) |
|
316 | request = util.urlreq.request(href) | |
317 | if action == 'upload': |
|
317 | if action == 'upload': | |
318 | # If uploading blobs, read data from local blobstore. |
|
318 | # If uploading blobs, read data from local blobstore. | |
319 |
|
|
319 | if not localstore.verify(oid): | |
320 | _verifyfile(oid, fp) |
|
320 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, | |
|
321 | hint=_('run hg verify')) | |||
321 | request.data = filewithprogress(localstore.open(oid), None) |
|
322 | request.data = filewithprogress(localstore.open(oid), None) | |
322 | request.get_method = lambda: 'PUT' |
|
323 | request.get_method = lambda: 'PUT' | |
323 |
|
324 | |||
@@ -491,18 +492,6 b' def _verify(oid, content):' | |||||
491 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, |
|
492 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, | |
492 | hint=_('run hg verify')) |
|
493 | hint=_('run hg verify')) | |
493 |
|
494 | |||
494 | def _verifyfile(oid, fp): |
|
|||
495 | sha256 = hashlib.sha256() |
|
|||
496 | while True: |
|
|||
497 | data = fp.read(1024 * 1024) |
|
|||
498 | if not data: |
|
|||
499 | break |
|
|||
500 | sha256.update(data) |
|
|||
501 | realoid = sha256.hexdigest() |
|
|||
502 | if realoid != oid: |
|
|||
503 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, |
|
|||
504 | hint=_('run hg verify')) |
|
|||
505 |
|
||||
506 | def remote(repo): |
|
495 | def remote(repo): | |
507 | """remotestore factory. return a store in _storemap depending on config""" |
|
496 | """remotestore factory. return a store in _storemap depending on config""" | |
508 | url = util.url(repo.ui.config('lfs', 'url') or '') |
|
497 | url = util.url(repo.ui.config('lfs', 'url') or '') |
General Comments 0
You need to be logged in to leave comments.
Login now