diff hgext/fsmonitor/state.py @ 49306: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 642e31cb55f0
children f4733654f144
line wrap: on
line diff
--- a/hgext/fsmonitor/state.py	Tue May 31 21:16:17 2022 +0200
+++ b/hgext/fsmonitor/state.py	Tue May 31 22:50:01 2022 +0200
@@ -137,9 +137,8 @@
     def invalidate(self):
         try:
             os.unlink(os.path.join(self._rootdir, b'.hg', b'fsmonitor.state'))
-        except OSError as inst:
-            if inst.errno != errno.ENOENT:
-                raise
+        except FileNotFoundError:
+            pass
         self._identity = util.filestat(None)
 
     def setlastclock(self, clock):