mercurial/transaction.py
changeset 49314 2e726c934fcd
parent 49004 f254fc73d956
child 50049 2f348babe30d
--- a/mercurial/transaction.py	Tue May 31 21:16:17 2022 +0200
+++ b/mercurial/transaction.py	Tue May 31 22:50:01 2022 +0200
@@ -12,8 +12,6 @@
 # GNU General Public License version 2 or any later version.
 
 
-import errno
-
 from .i18n import _
 from . import (
     error,
@@ -71,9 +69,8 @@
         else:
             try:
                 opener.unlink(f)
-            except (IOError, OSError) as inst:
-                if inst.errno != errno.ENOENT:
-                    raise
+            except FileNotFoundError:
+                pass
 
     backupfiles = []
     for l, f, b, c in backupentries:
@@ -95,9 +92,8 @@
                 target = f or b
                 try:
                     vfs.unlink(target)
-                except (IOError, OSError) as inst:
-                    if inst.errno != errno.ENOENT:
-                        raise
+                except FileNotFoundError:
+                    pass
         except (IOError, OSError, error.Abort):
             if not c:
                 raise