mercurial/transaction.py
changeset 49314 2e726c934fcd
parent 49004 f254fc73d956
child 50049 2f348babe30d
equal deleted inserted replaced
49313:53e9422a9b45 49314:2e726c934fcd
     9 # Copyright 2005, 2006 Olivia Mackall <olivia@selenic.com>
     9 # Copyright 2005, 2006 Olivia Mackall <olivia@selenic.com>
    10 #
    10 #
    11 # This software may be used and distributed according to the terms of the
    11 # This software may be used and distributed according to the terms of the
    12 # GNU General Public License version 2 or any later version.
    12 # GNU General Public License version 2 or any later version.
    13 
    13 
    14 
       
    15 import errno
       
    16 
    14 
    17 from .i18n import _
    15 from .i18n import _
    18 from . import (
    16 from . import (
    19     error,
    17     error,
    20     pycompat,
    18     pycompat,
    69                 report(_(b"failed to truncate %s\n") % f)
    67                 report(_(b"failed to truncate %s\n") % f)
    70                 raise
    68                 raise
    71         else:
    69         else:
    72             try:
    70             try:
    73                 opener.unlink(f)
    71                 opener.unlink(f)
    74             except (IOError, OSError) as inst:
    72             except FileNotFoundError:
    75                 if inst.errno != errno.ENOENT:
    73                 pass
    76                     raise
       
    77 
    74 
    78     backupfiles = []
    75     backupfiles = []
    79     for l, f, b, c in backupentries:
    76     for l, f, b, c in backupentries:
    80         if l not in vfsmap and c:
    77         if l not in vfsmap and c:
    81             report(b"couldn't handle %s: unknown cache location %s\n" % (b, l))
    78             report(b"couldn't handle %s: unknown cache location %s\n" % (b, l))
    93                     report(_(b"failed to recover %s (%s)\n") % (f, e_msg))
    90                     report(_(b"failed to recover %s (%s)\n") % (f, e_msg))
    94             else:
    91             else:
    95                 target = f or b
    92                 target = f or b
    96                 try:
    93                 try:
    97                     vfs.unlink(target)
    94                     vfs.unlink(target)
    98                 except (IOError, OSError) as inst:
    95                 except FileNotFoundError:
    99                     if inst.errno != errno.ENOENT:
    96                     pass
   100                         raise
       
   101         except (IOError, OSError, error.Abort):
    97         except (IOError, OSError, error.Abort):
   102             if not c:
    98             if not c:
   103                 raise
    99                 raise
   104 
   100 
   105     backuppath = b"%s.backupfiles" % journal
   101     backuppath = b"%s.backupfiles" % journal