transaction: properly clean up backup file outside of .hg/store/ stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Mar 2023 11:18:24 +0100
branchstable
changeset 50306 90276164333a
parent 50305 972f3e5c94b8
child 50307 70ca1f09ceca
transaction: properly clean up backup file outside of .hg/store/ Oops.
mercurial/transaction.py
--- a/mercurial/transaction.py	Tue Mar 07 17:13:38 2023 +0100
+++ b/mercurial/transaction.py	Wed Mar 15 11:18:24 2023 +0100
@@ -141,7 +141,7 @@
                 checkambig = checkambigfiles and (f, l) in checkambigfiles
                 try:
                     util.copyfile(backuppath, filepath, checkambig=checkambig)
-                    backupfiles.append(b)
+                    backupfiles.append((vfs, b))
                 except IOError as exc:
                     e_msg = stringutil.forcebytestr(exc)
                     report(_(b"failed to recover %s (%s)\n") % (f, e_msg))
@@ -160,9 +160,9 @@
         opener.unlink(backuppath)
     opener.unlink(journal)
     try:
-        for f in backupfiles:
-            if opener.exists(f):
-                opener.unlink(f)
+        for vfs, f in backupfiles:
+            if vfs.exists(f):
+                vfs.unlink(f)
     except (IOError, OSError, error.Abort):
         # only pure backup file remains, it is sage to ignore any error
         pass