equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 |
8 |
9 import errno |
|
10 import re |
9 import re |
11 |
10 |
12 from .i18n import _ |
11 from .i18n import _ |
13 from .pycompat import getattr |
12 from .pycompat import getattr |
14 from . import ( |
13 from . import ( |
573 fctx.audit() |
572 fctx.audit() |
574 except error.Abort: |
573 except error.Abort: |
575 return False |
574 return False |
576 try: |
575 try: |
577 return predfn(fctx) |
576 return predfn(fctx) |
578 except (IOError, OSError) as e: |
577 # open()-ing a directory fails with PermissionError on Windows |
579 # open()-ing a directory fails with EACCES on Windows |
578 except ( |
580 if e.errno in ( |
579 FileNotFoundError, |
581 errno.ENOENT, |
580 PermissionError, |
582 errno.EACCES, |
581 NotADirectoryError, |
583 errno.ENOTDIR, |
582 IsADirectoryError, |
584 errno.EISDIR, |
583 ): |
585 ): |
584 return False |
586 return False |
|
587 raise |
|
588 |
585 |
589 else: |
586 else: |
590 |
587 |
591 def fctxpredfn(f): |
588 def fctxpredfn(f): |
592 try: |
589 try: |