diff mercurial/transaction.py @ 50460:f57f5ab0e220

branching: merge stable into default
author Rapha?l Gom?s <rgomes@octobus.net>
date Tue, 09 May 2023 11:35:50 +0200
parents 392e2f31444a a445194f0a4d
children 63dc24be635d
line wrap: on
line diff
--- a/mercurial/transaction.py	Fri Apr 28 12:12:42 2023 +0200
+++ b/mercurial/transaction.py	Tue May 09 11:35:50 2023 +0200
@@ -414,6 +414,11 @@
         if vfs.exists(file):
             filepath = vfs.join(file)
             backuppath = vfs.join(backupfile)
+            # store encoding may result in different directory here.
+            # so we have to ensure the destination directory exist
+            final_dir_name = os.path.dirname(backuppath)
+            util.makedirs(final_dir_name, mode=vfs.createmode, notindexed=True)
+            # then we can copy the backup
             util.copyfile(filepath, backuppath, hardlink=hardlink)
         else:
             backupfile = b''