Mercurial > public > mercurial-scm > hg-stable
diff mercurial/shelve.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 | d44e3c45f0e4 |
children | f0a3aaa07d6a 35c9f0bc2648 |
line wrap: on
line diff
--- a/mercurial/shelve.py Tue May 31 21:16:17 2022 +0200 +++ b/mercurial/shelve.py Tue May 31 22:50:01 2022 +0200 @@ -22,7 +22,6 @@ """ import collections -import errno import itertools import stat @@ -82,9 +81,7 @@ """return all shelves in repo as list of (time, name)""" try: names = self.vfs.listdir() - except OSError as err: - if err.errno != errno.ENOENT: - raise + except FileNotFoundError: return [] info = [] seen = set() @@ -724,9 +721,7 @@ state = shelvedstate.load(repo) if opts.get(b'keep') is None: opts[b'keep'] = state.keep - except IOError as err: - if err.errno != errno.ENOENT: - raise + except FileNotFoundError: cmdutil.wrongtooltocontinue(repo, _(b'unshelve')) except error.CorruptedState as err: ui.debug(pycompat.bytestr(err) + b'\n')