repoview: ignore unwritable hidden cache stable
authorMatt Mackall <>
Thu, 28 Apr 2016 16:26:18 -0500
changeset 31393 a4dc5fe7bf54c339e1c23ff22cf061ad104a1701
parent 31392 e3055b46ed1b927f11cf3d74acb83b04b304e657
child 31394 b962ae0a0a058d15053685dffdb508d36cd89b11
push id225
push dateThu, 05 May 2016 16:13:29 +0000
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.
--- a/mercurial/
+++ b/mercurial/
@@ -125,23 +125,22 @@ def trywritehiddencache(repo, hideable, 
     wlock = fh = None
         wlock = repo.wlock(wait=False)
         # write cache to file
         newhash = cachehash(repo, hideable)
         fh =, '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')
-        if fh:
-            fh.close()
         if wlock:
 def tryreadcache(repo, hideable):
     """read a cache if the cache exists and is valid, otherwise returns None."""
     hidden = fh = None
         if repo.vfs.exists(cachefile):