comparison mercurial/vfs.py @ 51889:22e1924e9402

typing: make `vfs.isfileorlink_checkdir()` path arg required The only caller to this is `merge._checkunknownfile()`, which supplies a value. That's good, because `util.localpath()` immediately uses the value to call a method on it on Windows. The posix implementation returns the value unaltered, but then `pathutil.finddirs_rev_noroot()` would have exploded.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 21 Sep 2024 13:53:05 -0400
parents fa9e8a6521c1
children 992fcf6b2473
comparison
equal deleted inserted replaced
51888:fa9e8a6521c1 51889:22e1924e9402
502 self.audit(path, mode=mode) 502 self.audit(path, mode=mode)
503 503
504 def isfileorlink_checkdir( 504 def isfileorlink_checkdir(
505 self, 505 self,
506 dircache: MutableMapping[bytes, bool], 506 dircache: MutableMapping[bytes, bool],
507 path: Optional[bytes] = None, 507 path: bytes,
508 ) -> bool: 508 ) -> bool:
509 """return True if the path is a regular file or a symlink and 509 """return True if the path is a regular file or a symlink and
510 the directories along the path are "normal", that is 510 the directories along the path are "normal", that is
511 not symlinks or nested hg repositories. 511 not symlinks or nested hg repositories.
512 512
513 Ignores the `_audit` setting, and checks the directories regardless. 513 Ignores the `_audit` setting, and checks the directories regardless.
514 `dircache` is used to cache the directory checks. 514 `dircache` is used to cache the directory checks.
515 """ 515 """
516 # TODO: Should be a None check on 'path', or shouldn't default to None
517 # because of the immediate call to util.localpath().
518 try: 516 try:
519 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)): 517 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)):
520 if prefix in dircache: 518 if prefix in dircache:
521 res = dircache[prefix] 519 res = dircache[prefix]
522 else: 520 else: