Mercurial > public > mercurial-scm > hg-stable
diff mercurial/transaction.py @ 49314:2e726c934fcd
py3: catch FileNotFoundError instead of checking errno == ENOENT
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 31 May 2022 22:50:01 +0200 |
parents | f254fc73d956 |
children | 2f348babe30d |
line wrap: on
line diff
--- a/mercurial/transaction.py Tue May 31 21:16:17 2022 +0200 +++ b/mercurial/transaction.py Tue May 31 22:50:01 2022 +0200 @@ -12,8 +12,6 @@ # GNU General Public License version 2 or any later version. -import errno - from .i18n import _ from . import ( error, @@ -71,9 +69,8 @@ else: try: opener.unlink(f) - except (IOError, OSError) as inst: - if inst.errno != errno.ENOENT: - raise + except FileNotFoundError: + pass backupfiles = [] for l, f, b, c in backupentries: @@ -95,9 +92,8 @@ target = f or b try: vfs.unlink(target) - except (IOError, OSError) as inst: - if inst.errno != errno.ENOENT: - raise + except FileNotFoundError: + pass except (IOError, OSError, error.Abort): if not c: raise