Mercurial > public > mercurial-scm > hg
comparison mercurial/vfs.py @ 49912:bc83ebe07bf0
pathauditor: make _checkfs_exists a static method
This fixes the bug detected by pytype where the auditor
used in vfs.py may be a no-op auditor (vfs.py, line 398),
which doesn't have the _checkfs_exists method.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 12 Jan 2023 16:15:51 +0000 |
parents | b7cf91ef03ba |
children | d1d458fb96a5 |
comparison
equal
deleted
inserted
replaced
49911:c7a04bfabd4d | 49912:bc83ebe07bf0 |
---|---|
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 |