diff mercurial/grep.py @ 49306: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 f4733654f144
line wrap: on
line diff
--- a/mercurial/grep.py	Tue May 31 21:16:17 2022 +0200
+++ b/mercurial/grep.py	Tue May 31 22:50:01 2022 +0200
@@ -7,7 +7,6 @@
 
 
 import difflib
-import errno
 
 from .i18n import _
 
@@ -158,9 +157,8 @@
             fctx = ctx[fn]
             try:
                 return fctx.data()
-            except IOError as e:
-                if e.errno != errno.ENOENT:
-                    raise
+            except FileNotFoundError:
+                pass
         else:
             flog = self._getfile(fn)
             fnode = ctx.filenode(fn)