Show More
@@ -194,11 +194,11 b' class _gitlfsremote(object):' | |||||
194 |
|
194 | |||
195 | def writebatch(self, pointers, fromstore): |
|
195 | def writebatch(self, pointers, fromstore): | |
196 | """Batch upload from local to remote blobstore.""" |
|
196 | """Batch upload from local to remote blobstore.""" | |
197 | self._batch(pointers, fromstore, 'upload') |
|
197 | self._batch(_deduplicate(pointers), fromstore, 'upload') | |
198 |
|
198 | |||
199 | def readbatch(self, pointers, tostore): |
|
199 | def readbatch(self, pointers, tostore): | |
200 | """Batch download from remote to local blostore.""" |
|
200 | """Batch download from remote to local blostore.""" | |
201 | self._batch(pointers, tostore, 'download') |
|
201 | self._batch(_deduplicate(pointers), tostore, 'download') | |
202 |
|
202 | |||
203 | def _batchrequest(self, pointers, action): |
|
203 | def _batchrequest(self, pointers, action): | |
204 | """Get metadata about objects pointed by pointers for given action |
|
204 | """Get metadata about objects pointed by pointers for given action | |
@@ -399,13 +399,13 b' class _dummyremote(object):' | |||||
399 | self.vfs = lfsvfs(fullpath) |
|
399 | self.vfs = lfsvfs(fullpath) | |
400 |
|
400 | |||
401 | def writebatch(self, pointers, fromstore): |
|
401 | def writebatch(self, pointers, fromstore): | |
402 | for p in pointers: |
|
402 | for p in _deduplicate(pointers): | |
403 | content = fromstore.read(p.oid(), verify=True) |
|
403 | content = fromstore.read(p.oid(), verify=True) | |
404 | with self.vfs(p.oid(), 'wb', atomictemp=True) as fp: |
|
404 | with self.vfs(p.oid(), 'wb', atomictemp=True) as fp: | |
405 | fp.write(content) |
|
405 | fp.write(content) | |
406 |
|
406 | |||
407 | def readbatch(self, pointers, tostore): |
|
407 | def readbatch(self, pointers, tostore): | |
408 | for p in pointers: |
|
408 | for p in _deduplicate(pointers): | |
409 | with self.vfs(p.oid(), 'rb') as fp: |
|
409 | with self.vfs(p.oid(), 'rb') as fp: | |
410 | tostore.download(p.oid(), fp) |
|
410 | tostore.download(p.oid(), fp) | |
411 |
|
411 | |||
@@ -444,6 +444,13 b' class _promptremote(object):' | |||||
444 | None: _promptremote, |
|
444 | None: _promptremote, | |
445 | } |
|
445 | } | |
446 |
|
446 | |||
|
447 | def _deduplicate(pointers): | |||
|
448 | """Remove any duplicate oids that exist in the list""" | |||
|
449 | reduced = util.sortdict() | |||
|
450 | for p in pointers: | |||
|
451 | reduced[p.oid()] = p | |||
|
452 | return reduced.values() | |||
|
453 | ||||
447 | def _verify(oid, content): |
|
454 | def _verify(oid, content): | |
448 | realoid = hashlib.sha256(content).hexdigest() |
|
455 | realoid = hashlib.sha256(content).hexdigest() | |
449 | if realoid != oid: |
|
456 | if realoid != oid: |
@@ -153,12 +153,10 b' Archive will prefetch blobs in a group' | |||||
153 |
|
153 | |||
154 | $ rm -rf .hg/store/lfs `hg config lfs.usercache` |
|
154 | $ rm -rf .hg/store/lfs `hg config lfs.usercache` | |
155 | $ hg archive -vr 1 ../archive |
|
155 | $ hg archive -vr 1 ../archive | |
156 |
lfs: need to transfer |
|
156 | lfs: need to transfer 3 objects (51 bytes) | |
157 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
157 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) | |
158 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache |
|
158 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache | |
159 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
159 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b | |
160 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
|||
161 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
|||
162 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) |
|
160 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) | |
163 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache |
|
161 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache | |
164 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 |
|
162 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 | |
@@ -181,12 +179,10 b' Cat will prefetch blobs in a group' | |||||
181 |
|
179 | |||
182 | $ rm -rf .hg/store/lfs `hg config lfs.usercache` |
|
180 | $ rm -rf .hg/store/lfs `hg config lfs.usercache` | |
183 | $ hg cat -vr 1 a b c |
|
181 | $ hg cat -vr 1 a b c | |
184 |
lfs: need to transfer |
|
182 | lfs: need to transfer 2 objects (31 bytes) | |
185 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
183 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) | |
186 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache |
|
184 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache | |
187 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
185 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b | |
188 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
|||
189 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
|||
190 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) |
|
186 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) | |
191 | lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache |
|
187 | lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache | |
192 | lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 |
|
188 | lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 | |
@@ -207,12 +203,10 b' Revert will prefetch blobs in a group' | |||||
207 | reverting b |
|
203 | reverting b | |
208 | reverting c |
|
204 | reverting c | |
209 | reverting d |
|
205 | reverting d | |
210 |
lfs: need to transfer |
|
206 | lfs: need to transfer 3 objects (51 bytes) | |
211 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
207 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) | |
212 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache |
|
208 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache | |
213 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
209 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b | |
214 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
|||
215 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
|||
216 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) |
|
210 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) | |
217 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache |
|
211 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache | |
218 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 |
|
212 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 |
General Comments 0
You need to be logged in to leave comments.
Login now