mercurial/transaction.py
branchstable
changeset 50306 90276164333a
parent 50291 862969b6c359
child 50307 70ca1f09ceca
equal deleted inserted replaced
50305:972f3e5c94b8 50306:90276164333a
   139                 filepath = vfs.join(f)
   139                 filepath = vfs.join(f)
   140                 backuppath = vfs.join(b)
   140                 backuppath = vfs.join(b)
   141                 checkambig = checkambigfiles and (f, l) in checkambigfiles
   141                 checkambig = checkambigfiles and (f, l) in checkambigfiles
   142                 try:
   142                 try:
   143                     util.copyfile(backuppath, filepath, checkambig=checkambig)
   143                     util.copyfile(backuppath, filepath, checkambig=checkambig)
   144                     backupfiles.append(b)
   144                     backupfiles.append((vfs, b))
   145                 except IOError as exc:
   145                 except IOError as exc:
   146                     e_msg = stringutil.forcebytestr(exc)
   146                     e_msg = stringutil.forcebytestr(exc)
   147                     report(_(b"failed to recover %s (%s)\n") % (f, e_msg))
   147                     report(_(b"failed to recover %s (%s)\n") % (f, e_msg))
   148             else:
   148             else:
   149                 target = f or b
   149                 target = f or b
   158     backuppath = b"%s.backupfiles" % journal
   158     backuppath = b"%s.backupfiles" % journal
   159     if opener.exists(backuppath):
   159     if opener.exists(backuppath):
   160         opener.unlink(backuppath)
   160         opener.unlink(backuppath)
   161     opener.unlink(journal)
   161     opener.unlink(journal)
   162     try:
   162     try:
   163         for f in backupfiles:
   163         for vfs, f in backupfiles:
   164             if opener.exists(f):
   164             if vfs.exists(f):
   165                 opener.unlink(f)
   165                 vfs.unlink(f)
   166     except (IOError, OSError, error.Abort):
   166     except (IOError, OSError, error.Abort):
   167         # only pure backup file remains, it is sage to ignore any error
   167         # only pure backup file remains, it is sage to ignore any error
   168         pass
   168         pass
   169 
   169 
   170 
   170