hghave: use try/except/finally
authorMatt Mackall <mpm@selenic.com>
Fri, 15 May 2015 10:29:39 -0500
changeset 25090 252412e24551
parent 25089 c6427cd45760
child 25091 b5052fc73300
hghave: use try/except/finally
tests/hghave.py
--- a/tests/hghave.py	Fri May 15 10:00:46 2015 -0500
+++ b/tests/hghave.py	Fri May 15 10:29:39 2015 -0500
@@ -225,12 +225,11 @@
     os.close(fh)
     name = tempfile.mktemp(dir='.', prefix=tempprefix)
     try:
-        try:
-            util.oslink(fn, name)
-            os.unlink(name)
-            return True
-        except OSError:
-            return False
+        util.oslink(fn, name)
+        os.unlink(name)
+        return True
+    except OSError:
+        return False
     finally:
         os.unlink(fn)