On Mon, 9 Apr 2018 11:28:54 -0400, Matt Harbison wrote:
> 
> > On Apr 9, 2018, at 9:21 AM, Yuya Nishihara <y...@tcha.org> wrote:
> > 
> >> On Mon, 09 Apr 2018 00:26:42 -0400, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbi...@yahoo.com>
> >> # Date 1523155211 14400
> >> #      Sat Apr 07 22:40:11 2018 -0400
> >> # Node ID f4381233ecb960307d39459ea961a0af03df442b
> >> # Parent  69ead78af94459ca41e529d0ebfb24bd1d11c32c
> >> lfs: add the ability to disable the usercache
> > 
> >> +class nullvfs(lfsvfs):
> >> +    def __init__(self):
> >> +        pass
> >> +
> >> +    def exists(self, oid):
> >> +        return False
> >> +
> >> +    def read(self, oid):
> >> +        raise IOError('%s: No such file or directory' % self.join(oid))
> >> +
> >> +    def walk(self, path=None, onerror=None):
> >> +        return ('', [], [])
> >> +
> >> +    def write(self, oid, data):
> >> +        pass
> > 
> > I don't think this abstraction would work nicely. For example, local.read()
> > expects something exists in usercache.
> > 
> >    def read(self, oid, verify=True):
> >        """Read blob from local blobstore."""
> >        if not self.vfs.exists(oid):
> >            blob = self._read(self.cachevfs, oid, verify)
> 
> That initially gave me pause too. But vfs.read(oid) inside _read() will also 
> fail if the file doesn’t exist.  So before reading from the store, all code 
> calls store.exists(oid).  Since the nullvfs always says the file doesn’t 
> exist, the only way for a store to say it exists is if self.vfs (the repo 
> internal store) has it.  That’s the desired behavior.
> 
> The only thing I was puzzling over after seeing that was if nullvfs.read() 
> should raise an error or return an empty string- it should never be called.

Can you run all lfs tests with the nullvfs to see if nullvfs is mostly
working? I got some AttributeError.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to