hgext/share.py
branchstable
changeset 49366 288de6f5d724
parent 49306 2e726c934fcd
child 50796 7a50e1720f6d
--- a/hgext/share.py	Thu Jun 16 15:15:03 2022 +0200
+++ b/hgext/share.py	Thu Jun 16 15:28:54 2022 +0200
@@ -65,9 +65,7 @@
     and there are no untracked files, delete that share and create a new share.
 '''
 
-from __future__ import absolute_import
 
-import errno
 from mercurial.i18n import _
 from mercurial import (
     bookmarks,
@@ -178,9 +176,7 @@
         return False
     try:
         shared = repo.vfs.read(b'shared').splitlines()
-    except IOError as inst:
-        if inst.errno != errno.ENOENT:
-            raise
+    except FileNotFoundError:
         return False
     return hg.sharedbookmarks in shared
 
@@ -200,9 +196,8 @@
                     # is up-to-date.
                     return fp
                 fp.close()
-            except IOError as inst:
-                if inst.errno != errno.ENOENT:
-                    raise
+            except FileNotFoundError:
+                pass
 
             # otherwise, we should read bookmarks from srcrepo,
             # because .hg/bookmarks in srcrepo might be already