transaction: more specific exceptions, os.unlink can raise OSError
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 31 Oct 2009 18:17:59 +0100
changeset 9686 ddf2adf88b89
parent 9685 a820cd39d415
child 9687 c6da1cb3b255
transaction: more specific exceptions, os.unlink can raise OSError
mercurial/transaction.py
--- a/mercurial/transaction.py	Sat Oct 31 18:10:52 2009 +0100
+++ b/mercurial/transaction.py	Sat Oct 31 18:17:59 2009 +0100
@@ -28,14 +28,14 @@
         if o or not unlink:
             try:
                 opener(f, 'a').truncate(o)
-            except:
+            except IOError:
                 report(_("failed to truncate %s\n") % f)
                 raise
         else:
             try:
                 fn = opener(f).name
                 os.unlink(fn)
-            except IOError, inst:
+            except (IOError, OSError), inst:
                 if inst.errno != errno.ENOENT:
                     raise
     os.unlink(journal)