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