mercurial/vfs.py
branchstable
changeset 33649 377e8ddaebef
parent 33435 456626e9c3d1
child 34022 d5b2beca16c0
equal deleted inserted replaced
33648:47ea28293d30 33649:377e8ddaebef
   293 class vfs(abstractvfs):
   293 class vfs(abstractvfs):
   294     '''Operate files relative to a base directory
   294     '''Operate files relative to a base directory
   295 
   295 
   296     This class is used to hide the details of COW semantics and
   296     This class is used to hide the details of COW semantics and
   297     remote file access from higher level code.
   297     remote file access from higher level code.
       
   298 
       
   299     'cacheaudited' should be enabled only if (a) vfs object is short-lived, or
       
   300     (b) the base directory is managed by hg and considered sort-of append-only.
       
   301     See pathutil.pathauditor() for details.
   298     '''
   302     '''
   299     def __init__(self, base, audit=True, expandpath=False, realpath=False):
   303     def __init__(self, base, audit=True, cacheaudited=False, expandpath=False,
       
   304                  realpath=False):
   300         if expandpath:
   305         if expandpath:
   301             base = util.expandpath(base)
   306             base = util.expandpath(base)
   302         if realpath:
   307         if realpath:
   303             base = os.path.realpath(base)
   308             base = os.path.realpath(base)
   304         self.base = base
   309         self.base = base
   305         self._audit = audit
   310         self._audit = audit
   306         if audit:
   311         if audit:
   307             self.audit = pathutil.pathauditor(self.base)
   312             self.audit = pathutil.pathauditor(self.base, cached=cacheaudited)
   308         else:
   313         else:
   309             self.audit = (lambda path, mode=None: True)
   314             self.audit = (lambda path, mode=None: True)
   310         self.createmode = None
   315         self.createmode = None
   311         self._trustnlink = None
   316         self._trustnlink = None
   312 
   317