changeset 29040:a4dc5fe7bf54 stable

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.
author Matt Mackall <mpm@selenic.com>
date Thu, 28 Apr 2016 16:26:18 -0500
parents e3055b46ed1b
children b962ae0a0a05
files mercurial/repoview.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()