Mercurial > hg-stable
changeset 22174:0cc2db64c335
repoview: fix try/except/finally for py2.4
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 Aug 2014 16:39:02 -0500 |
parents | d3702a822241 |
children | 2965804483e3 |
files | mercurial/repoview.py |
diffstat | 1 files changed, 14 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repoview.py Thu Aug 14 16:25:47 2014 -0500 +++ b/mercurial/repoview.py Thu Aug 14 16:39:02 2014 -0500 @@ -85,19 +85,20 @@ """ wlock = fh = None try: - wlock = repo.wlock(wait=False) - # write cache to file - newhash = cachehash(repo, hideable) - sortedset = sorted(hidden) - data = struct.pack('>%iI' % len(sortedset), *sortedset) - fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) - fh.write(struct.pack(">H", cacheversion)) - fh.write(newhash) - fh.write(data) - except (IOError, OSError): - repo.ui.debug('error writing hidden changesets cache') - except error.LockHeld: - repo.ui.debug('cannot obtain lock to write hidden changesets cache') + try: + wlock = repo.wlock(wait=False) + # write cache to file + newhash = cachehash(repo, hideable) + sortedset = sorted(hidden) + data = struct.pack('>%iI' % len(sortedset), *sortedset) + fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) + fh.write(struct.pack(">H", cacheversion)) + fh.write(newhash) + fh.write(data) + except (IOError, OSError): + repo.ui.debug('error writing hidden changesets cache') + except error.LockHeld: + repo.ui.debug('cannot obtain lock to write hidden changesets cache') finally: if fh: fh.close()