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

Henrik Stuart henrik.stuart at edlund.dk
Tue Jul 7 11:48:29 CDT 2009


Matt Mackall wrote:
> 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.

Perhaps it only needs to catch IOError, guess that merits some
investigation.

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

My bad, forgot to remove it again after some debugging. should just be
the one line change for catching the exception.

-- 
Kind regards,
  Henrik Stuart


More information about the Mercurial-devel mailing list