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

Matt Mackall mpm at selenic.com
Tue Jul 7 11:44:33 CDT 2009


On Tue, 2009-07-07 at 12:47 +0000, Henrik Stuart wrote:
> # 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.

Odd, ENOENT's an IOError on Unix too.

> 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)

Why the new import?

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list