Patchwork D6465: narrowspec: use vfs.tryread() instead of reimplementing

login
register
mail settings
Submitter phabricator
Date June 1, 2019, 11:36 a.m.
Message ID <bb252616e8fd0f17da835a4212cb4734@localhost.localdomain>
Download mbox | patch
Permalink /patch/40297/
State Not Applicable
Headers show

Comments

phabricator - June 1, 2019, 11:36 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0c0a22f5b0b5: narrowspec: use vfs.tryread() instead of reimplementing (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6465?vs=15311&id=15321

REVISION DETAIL
  https://phab.mercurial-scm.org/D6465

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

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 @@ 
     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):