##// END OF EJS Templates
lfs: use the localstore download method to transfer from remote stores...
Matt Harbison -
r35566:fd610bef default
parent child Browse files
Show More
@@ -299,19 +299,21 b' class _gitlfsremote(object):'
299 response = b''
299 response = b''
300 try:
300 try:
301 req = self.urlopener.open(request)
301 req = self.urlopener.open(request)
302 while True:
302 if action == 'download':
303 data = req.read(1048576)
303 # If downloading blobs, store downloaded data to local blobstore
304 if not data:
304 localstore.download(oid, req)
305 break
305 else:
306 response += data
306 while True:
307 data = req.read(1048576)
308 if not data:
309 break
310 response += data
311 if response:
312 self.ui.debug('lfs %s response: %s' % (action, response))
307 except util.urlerr.httperror as ex:
313 except util.urlerr.httperror as ex:
308 raise LfsRemoteError(_('HTTP error: %s (oid=%s, action=%s)')
314 raise LfsRemoteError(_('HTTP error: %s (oid=%s, action=%s)')
309 % (ex, oid, action))
315 % (ex, oid, action))
310
316
311 if action == 'download':
312 # If downloading blobs, store downloaded data to local blobstore
313 localstore.write(oid, response, verify=True)
314
315 def _batch(self, pointers, localstore, action):
317 def _batch(self, pointers, localstore, action):
316 if action not in ['upload', 'download']:
318 if action not in ['upload', 'download']:
317 raise error.ProgrammingError('invalid Git-LFS action: %s' % action)
319 raise error.ProgrammingError('invalid Git-LFS action: %s' % action)
@@ -385,8 +387,8 b' class _dummyremote(object):'
385
387
386 def readbatch(self, pointers, tostore):
388 def readbatch(self, pointers, tostore):
387 for p in pointers:
389 for p in pointers:
388 content = self.vfs.read(p.oid())
390 with self.vfs(p.oid(), 'rb') as fp:
389 tostore.write(p.oid(), content, verify=True)
391 tostore.download(p.oid(), fp)
390
392
391 class _nullremote(object):
393 class _nullremote(object):
392 """Null store storing blobs to /dev/null."""
394 """Null store storing blobs to /dev/null."""
@@ -119,7 +119,6 b' Test a corrupt file download, but clear '
119 $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
119 $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
120 $ rm ../repo1/*
120 $ rm ../repo1/*
121
121
122 XXX: suggesting `hg verify` won't help with a corrupt file on the lfs server.
123 $ hg --repo ../repo1 update -C tip -v
122 $ hg --repo ../repo1 update -C tip -v
124 resolving manifests
123 resolving manifests
125 getting a
124 getting a
@@ -128,8 +127,7 b" XXX: suggesting `hg verify` won't help w"
128 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
127 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
129 getting c
128 getting c
130 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
129 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
131 abort: detected corrupt lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
130 abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
132 (run hg verify)
133 [255]
131 [255]
134
132
135 The corrupted blob is not added to the usercache or local store
133 The corrupted blob is not added to the usercache or local store
@@ -714,8 +714,7 b' Damaging a file required by the update d'
714 updating to branch default
714 updating to branch default
715 resolving manifests
715 resolving manifests
716 getting l
716 getting l
717 abort: detected corrupt lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
717 abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
718 (run hg verify)
719 [255]
718 [255]
720
719
721 A corrupted lfs blob is not transferred from a file://remotestore to the
720 A corrupted lfs blob is not transferred from a file://remotestore to the
General Comments 0
You need to be logged in to leave comments. Login now