changeset 51930: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
files mercurial/vfs.py
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/vfs.py	Fri Sep 20 20:16:12 2024 -0400
+++ b/mercurial/vfs.py	Sat Sep 21 13:53:05 2024 -0400
@@ -504,7 +504,7 @@
     def isfileorlink_checkdir(
         self,
         dircache: MutableMapping[bytes, bool],
-        path: Optional[bytes] = None,
+        path: bytes,
     ) -> bool:
         """return True if the path is a regular file or a symlink and
         the directories along the path are "normal", that is
@@ -513,8 +513,6 @@
         Ignores the `_audit` setting, and checks the directories regardless.
         `dircache` is used to cache the directory checks.
         """
-        # TODO: Should be a None check on 'path', or shouldn't default to None
-        #  because of the immediate call to util.localpath().
         try:
             for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)):
                 if prefix in dircache: