Mercurial > hg
diff hgext/remotefilelog/shallowutil.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 | d44e3c45f0e4 |
children | 8b369bcbadf1 |
line wrap: on
line diff
--- a/hgext/remotefilelog/shallowutil.py Tue May 31 16:54:58 2022 +0200 +++ b/hgext/remotefilelog/shallowutil.py Tue May 31 21:16:17 2022 +0200 @@ -6,7 +6,6 @@ # GNU General Public License version 2 or any later version. import collections -import errno import os import stat import struct @@ -359,9 +358,8 @@ if not os.path.exists(dirname): try: os.makedirs(dirname) - except OSError as ex: - if ex.errno != errno.EEXIST: - raise + except FileExistsError: + pass fd, temp = tempfile.mkstemp(prefix=b'.%s-' % filename, dir=dirname) os.close(fd) @@ -519,9 +517,8 @@ for path in reversed(missingdirs): try: os.mkdir(path) - except OSError as ex: - if ex.errno != errno.EEXIST: - raise + except FileExistsError: + pass for path in missingdirs: setstickygroupdir(path, gid, ui.warn)