mercurial/vfs.py
branchstable
changeset 33633 20bac46f7744
parent 31644 f80d9ddc40f3
equal deleted inserted replaced
33632:0134d839444b 33633:20bac46f7744
   274 class vfs(abstractvfs):
   274 class vfs(abstractvfs):
   275     '''Operate files relative to a base directory
   275     '''Operate files relative to a base directory
   276 
   276 
   277     This class is used to hide the details of COW semantics and
   277     This class is used to hide the details of COW semantics and
   278     remote file access from higher level code.
   278     remote file access from higher level code.
       
   279 
       
   280     'cacheaudited' should be enabled only if (a) vfs object is short-lived, or
       
   281     (b) the base directory is managed by hg and considered sort-of append-only.
       
   282     See pathutil.pathauditor() for details.
   279     '''
   283     '''
   280     def __init__(self, base, audit=True, expandpath=False, realpath=False):
   284     def __init__(self, base, audit=True, cacheaudited=False, expandpath=False,
       
   285                  realpath=False):
   281         if expandpath:
   286         if expandpath:
   282             base = util.expandpath(base)
   287             base = util.expandpath(base)
   283         if realpath:
   288         if realpath:
   284             base = os.path.realpath(base)
   289             base = os.path.realpath(base)
   285         self.base = base
   290         self.base = base
       
   291         self._cacheaudited = cacheaudited
   286         self.mustaudit = audit
   292         self.mustaudit = audit
   287         self.createmode = None
   293         self.createmode = None
   288         self._trustnlink = None
   294         self._trustnlink = None
   289 
   295 
   290     @property
   296     @property
   293 
   299 
   294     @mustaudit.setter
   300     @mustaudit.setter
   295     def mustaudit(self, onoff):
   301     def mustaudit(self, onoff):
   296         self._audit = onoff
   302         self._audit = onoff
   297         if onoff:
   303         if onoff:
   298             self.audit = pathutil.pathauditor(self.base)
   304             self.audit = pathutil.pathauditor(
       
   305                 self.base, cached=self._cacheaudited)
   299         else:
   306         else:
   300             self.audit = util.always
   307             self.audit = util.always
   301 
   308 
   302     @util.propertycache
   309     @util.propertycache
   303     def _cansymlink(self):
   310     def _cansymlink(self):