Mercurial > hg
comparison mercurial/repoview.py @ 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 | faff8c2b5ee3 |
children | 0d83ad967bf8 |
comparison
equal
deleted
inserted
replaced
29039:e3055b46ed1b | 29040:a4dc5fe7bf54 |
---|---|
128 wlock = repo.wlock(wait=False) | 128 wlock = repo.wlock(wait=False) |
129 # write cache to file | 129 # write cache to file |
130 newhash = cachehash(repo, hideable) | 130 newhash = cachehash(repo, hideable) |
131 fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) | 131 fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) |
132 _writehiddencache(fh, newhash, hidden) | 132 _writehiddencache(fh, newhash, hidden) |
133 fh.close() | |
133 except (IOError, OSError): | 134 except (IOError, OSError): |
134 repo.ui.debug('error writing hidden changesets cache\n') | 135 repo.ui.debug('error writing hidden changesets cache\n') |
135 except error.LockHeld: | 136 except error.LockHeld: |
136 repo.ui.debug('cannot obtain lock to write hidden changesets cache\n') | 137 repo.ui.debug('cannot obtain lock to write hidden changesets cache\n') |
137 finally: | 138 finally: |
138 if fh: | |
139 fh.close() | |
140 if wlock: | 139 if wlock: |
141 wlock.release() | 140 wlock.release() |
142 | 141 |
143 def tryreadcache(repo, hideable): | 142 def tryreadcache(repo, hideable): |
144 """read a cache if the cache exists and is valid, otherwise returns None.""" | 143 """read a cache if the cache exists and is valid, otherwise returns None.""" |