repoview: fix try/except/finally for py2.4
authorMatt Mackall <mpm@selenic.com>
Thu, 14 Aug 2014 16:39:02 -0500
changeset 22174 0cc2db64c335
parent 22173 d3702a822241
child 22175 2965804483e3
repoview: fix try/except/finally for py2.4
mercurial/repoview.py
--- 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()