mercurial/vfs.py
changeset 49909 b7cf91ef03ba
parent 49574 2506c3ac73f4
child 49912 bc83ebe07bf0
equal deleted inserted replaced
49908:789e152a6bdb 49909:b7cf91ef03ba
   419                 path = os.path.relpath(path, self.base)
   419                 path = os.path.relpath(path, self.base)
   420             r = util.checkosfilename(path)
   420             r = util.checkosfilename(path)
   421             if r:
   421             if r:
   422                 raise error.Abort(b"%s: %r" % (r, path))
   422                 raise error.Abort(b"%s: %r" % (r, path))
   423             self.audit(path, mode=mode)
   423             self.audit(path, mode=mode)
       
   424 
       
   425     def isfileorlink_checkdir(
       
   426         self, dircache, path: Optional[bytes] = None
       
   427     ) -> bool:
       
   428         """return True if the path is a regular file or a symlink and
       
   429         the directories along the path are "normal", that is
       
   430         not symlinks or nested hg repositories."""
       
   431         try:
       
   432             for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)):
       
   433                 if prefix in dircache:
       
   434                     res = dircache[prefix]
       
   435                 else:
       
   436                     res = self.audit._checkfs_exists(prefix, path)
       
   437                     dircache[prefix] = res
       
   438                 if not res:
       
   439                     return False
       
   440         except (OSError, error.Abort):
       
   441             return False
       
   442         return self.isfileorlink(path)
   424 
   443 
   425     def __call__(
   444     def __call__(
   426         self,
   445         self,
   427         path: bytes,
   446         path: bytes,
   428         mode: bytes = b"rb",
   447         mode: bytes = b"rb",