[PATCH 2 of 4 stable] tags: silence hgtagsfnodes reading failures

Matt Mackall mpm at selenic.com
Thu Apr 28 17:54:28 EDT 2016


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1461876043 18000
#      Thu Apr 28 15:40:43 2016 -0500
# Branch stable
# Node ID 369f16a0fbd46c826ee75eff85f7db51099e0d17
# Parent  30ea1355f34f85f4d7b5b0f4c8816fa44a35a8ed
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.

diff -r 30ea1355f34f -r 369f16a0fbd4 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
@@ -433,7 +433,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


More information about the Mercurial-devel mailing list