Mercurial > public > mercurial-scm > hg-stable
diff mercurial/windows.py @ 49313: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 | d500df2e8034 |
children | defc369d705e |
line wrap: on
line diff
--- a/mercurial/windows.py Tue May 31 16:54:58 2022 +0200 +++ b/mercurial/windows.py Tue May 31 21:16:17 2022 +0200 @@ -638,9 +638,7 @@ '''atomically rename file src to dst, replacing dst if it exists''' try: os.rename(src, dst) - except OSError as e: - if e.errno != errno.EEXIST: - raise + except FileExistsError: unlink(dst) os.rename(src, dst)