diff mercurial/streamclone.py @ 47871:132525ead0db stable

clone: properly create target directories during local clone (issue6581) The store encoding was mudding the water. This lead to local clone crashing for file with long filename as their destination directory needed to be encoded. Differential Revision: https://phab.mercurial-scm.org/D11340
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Aug 2021 11:32:49 +0200
parents 48f07adbda98
children 31a72e5e9200
line wrap: on
line diff
--- a/mercurial/streamclone.py	Wed Aug 25 10:00:55 2021 +0200
+++ b/mercurial/streamclone.py	Wed Aug 25 11:32:49 2021 +0200
@@ -821,9 +821,11 @@
         dst_vfs = dst_vfs_map[k]
         src_path = src_vfs.join(path)
         dst_path = dst_vfs.join(path)
-        dirname = dst_vfs.dirname(path)
-        if not dst_vfs.exists(dirname):
-            dst_vfs.makedirs(dirname)
+        # We cannot use dirname and makedirs of dst_vfs here because the store
+        # encoding confuses them. See issue 6581 for details.
+        dirname = os.path.dirname(dst_path)
+        if not os.path.exists(dirname):
+            util.makedirs(dirname)
         dst_vfs.register_file(path)
         # XXX we could use the #nb_bytes argument.
         util.copyfile(