--- a/mercurial/fileset.py Tue May 31 23:45:33 2022 +0200
+++ b/mercurial/fileset.py Wed Jun 01 00:47:25 2022 +0200
@@ -6,7 +6,6 @@
# GNU General Public License version 2 or any later version.
-import errno
import re
from .i18n import _
@@ -575,16 +574,14 @@
return False
try:
return predfn(fctx)
- except (IOError, OSError) as e:
- # open()-ing a directory fails with EACCES on Windows
- if e.errno in (
- errno.ENOENT,
- errno.EACCES,
- errno.ENOTDIR,
- errno.EISDIR,
- ):
- return False
- raise
+ # open()-ing a directory fails with PermissionError on Windows
+ except (
+ FileNotFoundError,
+ PermissionError,
+ NotADirectoryError,
+ IsADirectoryError,
+ ):
+ return False
else: