425 def isfileorlink_checkdir( |
425 def isfileorlink_checkdir( |
426 self, dircache, path: Optional[bytes] = None |
426 self, dircache, path: Optional[bytes] = None |
427 ) -> bool: |
427 ) -> bool: |
428 """return True if the path is a regular file or a symlink and |
428 """return True if the path is a regular file or a symlink and |
429 the directories along the path are "normal", that is |
429 the directories along the path are "normal", that is |
430 not symlinks or nested hg repositories.""" |
430 not symlinks or nested hg repositories. |
|
431 |
|
432 Ignores the `_audit` setting, and checks the directories regardless. |
|
433 `dircache` is used to cache the directory checks. |
|
434 """ |
431 try: |
435 try: |
432 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)): |
436 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)): |
433 if prefix in dircache: |
437 if prefix in dircache: |
434 res = dircache[prefix] |
438 res = dircache[prefix] |
435 else: |
439 else: |
436 res = self.audit._checkfs_exists(prefix, path) |
440 res = pathutil.pathauditor._checkfs_exists( |
|
441 self.base, prefix, path |
|
442 ) |
437 dircache[prefix] = res |
443 dircache[prefix] = res |
438 if not res: |
444 if not res: |
439 return False |
445 return False |
440 except (OSError, error.Abort): |
446 except (OSError, error.Abort): |
441 return False |
447 return False |