changeset 29039:e3055b46ed1b stable

tags: silence hgtagsfnodes reading failures tryread() doesn't handle "is a directory" errors and presumably others. We might not want to globally swallow such tryread errors, so we replace with our own try/except handling. An upcoming test will use directories as a portable stand-in for various bizarre circumstances that cache read/write code should be robust to.
author Matt Mackall <mpm@selenic.com>
date Thu, 28 Apr 2016 15:40:43 -0500
parents a9dd92c48a1c
children a4dc5fe7bf54
files mercurial/tags.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tags.py	Thu Apr 28 15:35:54 2016 -0500
+++ b/mercurial/tags.py	Thu Apr 28 15:40:43 2016 -0500
@@ -432,7 +432,10 @@
 
         self._raw = array('c')
 
-        data = repo.vfs.tryread(_fnodescachefile)
+        try:
+            data = repo.vfs.read(_fnodescachefile)
+        except (OSError, IOError):
+            data = ""
         self._raw.fromstring(data)
 
         # The end state of self._raw is an array that is of the exact length