Mercurial > hg
diff mercurial/hg.py @ 49305:53e9422a9b45
py3: catch FileExistsError instead of checking errno == EEXIST
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 31 May 2022 21:16:17 +0200 |
parents | c463f45fa114 |
children | 1e6c37360527 7d6c8943353a |
line wrap: on
line diff
--- 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'):