tags: silence hgtagsfnodes reading failures stable
authorMatt Mackall <mpm@selenic.com>
Thu, 28 Apr 2016 15:40:43 -0500
branchstable
changeset 29039 e3055b46ed1b
parent 29038 a9dd92c48a1c
child 29040 a4dc5fe7bf54
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.
mercurial/tags.py
--- 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