On Thu, 04 Jan 2018 21:56:52 -0500, Matt Harbison wrote:
> On Thu, 04 Jan 2018 02:39:40 -0500, Yuya Nishihara <y...@tcha.org> wrote:
> 
> > On Tue, 02 Jan 2018 22:49:13 -0500, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbi...@yahoo.com>
> >> # Date 1514945910 18000
> >> #      Tue Jan 02 21:18:30 2018 -0500
> >> # Node ID f5064b263d00efc996301c10173067677f874f09
> >> # Parent  0738d59d753f640ae3d7f310f77e6ec97912ed5c
> >> lfs: add a local store method for opening a blob
> >>
> >> The has() and read() methods already dynamically switch between the  
> >> usercache
> >> and local store.  This should generally be preferred to directly  
> >> accessing the
> >> vfs instances outside of the store.
> >>
> >> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
> >> --- a/hgext/lfs/blobstore.py
> >> +++ b/hgext/lfs/blobstore.py
> >> @@ -100,6 +100,14 @@
> >>          self.cachevfs = lfsvfs(usercache)
> >>          self.ui = repo.ui
> >>
> >> +    def open(self, oid, mode='rb'):
> >> +        """Open a file descriptor to the named blob, in either the  
> >> usercache or
> >> +        the local store."""
> >> +        if self.cachevfs.exists(oid):
> >> +            return self.cachevfs(oid, mode=mode)
> >> +
> >> +        return self.vfs(oid, mode=mode)
> >
> > Perhaps it's valid only for mode=read?
> 
> It seems valid for write mode too (local.write() will also create the file  
> in vfs, not cachevfs).

local.write() atomically creates a link in user cache. Perhaps it would avoid
exposing intermediate state to the other repository.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to