diff hgext/git/dirstate.py @ 49314:2e726c934fcd

py3: catch FileNotFoundError instead of checking errno == ENOENT
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 22:50:01 +0200
parents 020328be00cb
children 3c4d36a96a3e
line wrap: on
line diff
--- a/hgext/git/dirstate.py	Tue May 31 21:16:17 2022 +0200
+++ b/hgext/git/dirstate.py	Tue May 31 22:50:01 2022 +0200
@@ -1,5 +1,4 @@
 import contextlib
-import errno
 import os
 
 from mercurial.node import sha1nodeconstants
@@ -318,9 +317,7 @@
             # TODO construct the stat info from the status object?
             try:
                 s = os.stat(os.path.join(cwd, path))
-            except OSError as e:
-                if e.errno != errno.ENOENT:
-                    raise
+            except FileNotFoundError:
                 continue
             r[path] = s
         return r