hgext/lfs/blobstore.py
changeset 39457 a913d2892e17
parent 39389 b26350d9d7b5
child 39777 b63dee7bd0d9
equal deleted inserted replaced
39456:8d858fbf2759 39457:a913d2892e17
   165         store must use ``download()`` instead."""
   165         store must use ``download()`` instead."""
   166         with self.vfs(oid, 'wb', atomictemp=True) as fp:
   166         with self.vfs(oid, 'wb', atomictemp=True) as fp:
   167             fp.write(data)
   167             fp.write(data)
   168 
   168 
   169         self._linktousercache(oid)
   169         self._linktousercache(oid)
       
   170 
       
   171     def linkfromusercache(self, oid):
       
   172         """Link blobs found in the user cache into this store.
       
   173 
       
   174         The server module needs to do this when it lets the client know not to
       
   175         upload the blob, to ensure it is always available in this store.
       
   176         Normally this is done implicitly when the client reads or writes the
       
   177         blob, but that doesn't happen when the server tells the client that it
       
   178         already has the blob.
       
   179         """
       
   180         if (not isinstance(self.cachevfs, nullvfs)
       
   181             and not self.vfs.exists(oid)):
       
   182             self.ui.note(_('lfs: found %s in the usercache\n') % oid)
       
   183             lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid))
   170 
   184 
   171     def _linktousercache(self, oid):
   185     def _linktousercache(self, oid):
   172         # XXX: should we verify the content of the cache, and hardlink back to
   186         # XXX: should we verify the content of the cache, and hardlink back to
   173         # the local store on success, but truncate, write and link on failure?
   187         # the local store on success, but truncate, write and link on failure?
   174         if (not self.cachevfs.exists(oid)
   188         if (not self.cachevfs.exists(oid)