--- a/mercurial/hg.py Tue May 31 16:54:58 2022 +0200
+++ b/mercurial/hg.py Tue May 31 21:16:17 2022 +0200
@@ -7,7 +7,6 @@
# GNU General Public License version 2 or any later version.
-import errno
import os
import posixpath
import shutil
@@ -528,9 +527,8 @@
# lock class requires the directory to exist.
try:
util.makedir(pooldir, False)
- except OSError as e:
- if e.errno != errno.EEXIST:
- raise
+ except FileExistsError:
+ pass
poolvfs = vfsmod.vfs(pooldir)
basename = os.path.basename(sharepath)
@@ -893,13 +891,9 @@
create=True,
createopts=createopts,
)
- except OSError as inst:
- if inst.errno == errno.EEXIST:
- cleandir = None
- raise error.Abort(
- _(b"destination '%s' already exists") % dest
- )
- raise
+ except FileExistsError:
+ cleandir = None
+ raise error.Abort(_(b"destination '%s' already exists") % dest)
if revs:
if not srcpeer.capable(b'lookup'):