[PATCH 3 of 4 stable] repoview: ignore unwritable hidden cache

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


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1461878778 18000
#      Thu Apr 28 16:26:18 2016 -0500
# Branch stable
# Node ID 29c1fba34f3426a21ef692ae38bdfd5b49599c6a
# Parent  369f16a0fbd46c826ee75eff85f7db51099e0d17
repoview: ignore unwritable hidden cache

The atomictemp.close() file attempts to do a rename, which can fail.
Moving the close inside the exception handler fixes it.

This doesn't fit well with the with: pattern, as it's the finalizer
that's failing.

diff -r 369f16a0fbd4 -r 29c1fba34f34 mercurial/repoview.py
--- a/mercurial/repoview.py	Thu Apr 28 15:40:43 2016 -0500
+++ b/mercurial/repoview.py	Thu Apr 28 16:26:18 2016 -0500
@@ -130,13 +130,12 @@
         newhash = cachehash(repo, hideable)
         fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
         _writehiddencache(fh, newhash, hidden)
+        fh.close()
     except (IOError, OSError):
         repo.ui.debug('error writing hidden changesets cache\n')
     except error.LockHeld:
         repo.ui.debug('cannot obtain lock to write hidden changesets cache\n')
     finally:
-        if fh:
-            fh.close()
         if wlock:
             wlock.release()
 


More information about the Mercurial-devel mailing list