[PATCH] transaction: fix uncaught ENOENT on Windows (issue1724)

Henrik Stuart henrik.stuart at edlund.dk
Tue Jul 7 07:47:40 CDT 2009


# HG changeset patch
# User Henrik Stuart <henrik.stuart at edlund.dk>
# Date 1246970339 -7200
# Node ID 42c32267d7c4b9e59e46d301f9310c0a323151e4
# Parent  d4d4da54ab05c24596c3e98acbd7f052e443b2c1
transaction: fix uncaught ENOENT on Windows (issue1724)

The new posixfile raises an IOError where transaction expects an
OSError. The transaction code now checks for both issues as posixfile
is also used in places where an IOError is expected.

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -12,7 +12,7 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import os, errno
+import os, errno, sys
 import error
 
 def active(func):
@@ -35,7 +35,7 @@
             try:
                 fn = opener(f).name
                 os.unlink(fn)
-            except OSError, inst:
+            except (OSError, IOError), inst:
                 if inst.errno != errno.ENOENT:
                     raise
     os.unlink(journal)


More information about the Mercurial-devel mailing list