mercurial/patch.py
changeset 49306 2e726c934fcd
parent 49284 d44e3c45f0e4
child 50044 e8c170a6571d
--- a/mercurial/patch.py	Tue May 31 21:16:17 2022 +0200
+++ b/mercurial/patch.py	Tue May 31 22:50:01 2022 +0200
@@ -10,7 +10,6 @@
 import collections
 import contextlib
 import copy
-import errno
 import os
 import re
 import shutil
@@ -503,14 +502,11 @@
         isexec = False
         try:
             isexec = self.opener.lstat(fname).st_mode & 0o100 != 0
-        except OSError as e:
-            if e.errno != errno.ENOENT:
-                raise
+        except FileNotFoundError:
+            pass
         try:
             return (self.opener.read(fname), (False, isexec))
-        except IOError as e:
-            if e.errno != errno.ENOENT:
-                raise
+        except FileNotFoundError:
             return None, None
 
     def setfile(self, fname, data, mode, copysource):