mercurial/upgrade_utils/engine.py
changeset 49306 2e726c934fcd
parent 48875 6000f5b25c9b
child 49552 1994842955db
--- a/mercurial/upgrade_utils/engine.py	Tue May 31 21:16:17 2022 +0200
+++ b/mercurial/upgrade_utils/engine.py	Tue May 31 22:50:01 2022 +0200
@@ -6,7 +6,6 @@
 # GNU General Public License version 2 or any later version.
 
 
-import errno
 import stat
 
 from ..i18n import _
@@ -646,11 +645,10 @@
             util.copyfile(
                 srcrepo.vfs.join(b'dirstate'), backupvfs.join(b'dirstate')
             )
-        except (IOError, OSError) as e:
+        except FileNotFoundError:
             # The dirstate does not exist on an empty repo or a repo with no
             # revision checked out
-            if e.errno != errno.ENOENT:
-                raise
+            pass
 
     assert srcrepo.dirstate._use_dirstate_v2 == (old == b'v2')
     srcrepo.dirstate._map.preload()
@@ -659,11 +657,10 @@
     srcrepo.dirstate._dirty = True
     try:
         srcrepo.vfs.unlink(b'dirstate')
-    except (IOError, OSError) as e:
+    except FileNotFoundError:
         # The dirstate does not exist on an empty repo or a repo with no
         # revision checked out
-        if e.errno != errno.ENOENT:
-            raise
+        pass
 
     srcrepo.dirstate.write(None)