changeset 25088:754df8e932d3

util: use try/except/finally
author Matt Mackall <mpm@selenic.com>
date Fri, 15 May 2015 09:58:21 -0500
parents 559f24e3957d
children c6427cd45760
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri May 15 09:58:02 2015 -0500
+++ b/mercurial/util.py	Fri May 15 09:58:21 2015 -0500
@@ -1003,15 +1003,13 @@
     f2 = testfile + ".hgtmp2"
     fd = None
     try:
-        try:
-            oslink(f1, f2)
-        except OSError:
-            return False
-
+        oslink(f1, f2)
         # nlinks() may behave differently for files on Windows shares if
         # the file is open.
         fd = posixfile(f2)
         return nlinks(f2) > 1
+    except OSError:
+        return False
     finally:
         if fd is not None:
             fd.close()