# HG changeset patch # User Matt Mackall # Date 2016-04-28 21:26:18 # Node ID a4dc5fe7bf54c339e1c23ff22cf061ad104a1701 # Parent e3055b46ed1b927f11cf3d74acb83b04b304e657 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 --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -130,13 +130,12 @@ def trywritehiddencache(repo, hideable, 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()