hgext/remotefilelog/basestore.py
changeset 49306 2e726c934fcd
parent 49284 d44e3c45f0e4
child 50928 d718eddf01d9
--- a/hgext/remotefilelog/basestore.py	Tue May 31 21:16:17 2022 +0200
+++ b/hgext/remotefilelog/basestore.py	Tue May 31 22:50:01 2022 +0200
@@ -1,4 +1,3 @@
-import errno
 import os
 import shutil
 import stat
@@ -344,10 +343,7 @@
                 count += 1
                 try:
                     pathstat = os.stat(path)
-                except OSError as e:
-                    # errno.ENOENT = no such file or directory
-                    if e.errno != errno.ENOENT:
-                        raise
+                except FileNotFoundError:
                     msg = _(
                         b"warning: file %s was removed by another process\n"
                     )
@@ -362,10 +358,7 @@
                 else:
                     try:
                         shallowutil.unlinkfile(path)
-                    except OSError as e:
-                        # errno.ENOENT = no such file or directory
-                        if e.errno != errno.ENOENT:
-                            raise
+                    except FileNotFoundError:
                         msg = _(
                             b"warning: file %s was removed by another "
                             b"process\n"
@@ -388,10 +381,7 @@
                 atime, oldpath, oldpathstat = queue.get()
                 try:
                     shallowutil.unlinkfile(oldpath)
-                except OSError as e:
-                    # errno.ENOENT = no such file or directory
-                    if e.errno != errno.ENOENT:
-                        raise
+                except FileNotFoundError:
                     msg = _(
                         b"warning: file %s was removed by another process\n"
                     )