mercurial/tags.py
changeset 49306 2e726c934fcd
parent 49248 63fd0282ad40
child 49579 15a89b722937
--- a/mercurial/tags.py	Tue May 31 21:16:17 2022 +0200
+++ b/mercurial/tags.py	Tue May 31 22:50:01 2022 +0200
@@ -12,7 +12,6 @@
 
 
 import binascii
-import errno
 import io
 
 from .node import (
@@ -242,9 +241,7 @@
     '''Read local tags in repo. Update alltags and tagtypes.'''
     try:
         data = repo.vfs.read(b"localtags")
-    except IOError as inst:
-        if inst.errno != errno.ENOENT:
-            raise
+    except FileNotFoundError:
         return
 
     # localtags is in the local encoding; re-encode to UTF-8 on
@@ -652,9 +649,7 @@
 
     try:
         fp = repo.wvfs(b'.hgtags', b'rb+')
-    except IOError as e:
-        if e.errno != errno.ENOENT:
-            raise
+    except FileNotFoundError:
         fp = repo.wvfs(b'.hgtags', b'ab')
     else:
         prevtags = fp.read()