# HG changeset patch # User Martin von Zweigbergk # Date 2019-05-31 16:25:51 # Node ID 0c0a22f5b0b5d40301009181142ed88c92c15b61 # Parent 4ce7cdd78da3a6389705f0d8a80f20fc003412a1 narrowspec: use vfs.tryread() instead of reimplementing Note that parseconfig() works well with empty strings. Differential Revision: https://phab.mercurial-scm.org/D6465 diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py --- a/mercurial/narrowspec.py +++ b/mercurial/narrowspec.py @@ -7,8 +7,6 @@ from __future__ import absolute_import -import errno - from .i18n import _ from . import ( error, @@ -145,15 +143,9 @@ def parseconfig(ui, spec): return includepats, excludepats def load(repo): - try: - spec = repo.svfs.read(FILENAME) - except IOError as e: - # Treat "narrowspec does not exist" the same as "narrowspec file exists - # and is empty". - if e.errno == errno.ENOENT: - return set(), set() - raise - + # Treat "narrowspec does not exist" the same as "narrowspec file exists + # and is empty". + spec = repo.svfs.tryread(FILENAME) return parseconfig(repo.ui, spec) def save(repo, includepats, excludepats):