diff --git a/conan/tools/files/files.py b/conan/tools/files/files.py index 36453bb30d4..3a1d9cacd08 100644 --- a/conan/tools/files/files.py +++ b/conan/tools/files/files.py @@ -543,11 +543,10 @@ def collect_libs(conanfile, folder=None): return result -# TODO: Do NOT document this yet. It is unclear the interface, maybe should be split -def move_folder_contents(src_folder, dst_folder): - """ replaces the current folder contents with the contents of one child folder. This - is used in the SCM monorepo flow, when it is necessary to use one subproject subfolder - to replace the whole cloned git repo +def move_folder_contents(conanfile, src_folder, dst_folder): + """ replaces the dst_folder contents with the contents of the src_folder, which can be a + child folder of dst_folder. This is used in the SCM monorepo flow, when it is necessary + to use one subproject subfolder to replace the whole cloned git repo /base-folder /base-folder /pkg (src folder) /other/ /other/ /pkg/ diff --git a/conans/test/functional/tools/scm/test_git.py b/conans/test/functional/tools/scm/test_git.py index a4e873b86a1..50ed2c56f51 100644 --- a/conans/test/functional/tools/scm/test_git.py +++ b/conans/test/functional/tools/scm/test_git.py @@ -510,7 +510,7 @@ def source(self): sources = self.conan_data["sources"] git.clone(url=sources["url"], target=".") git.checkout(commit=sources["commit"]) - move_folder_contents(os.path.join(self.source_folder, sources["folder"]), + move_folder_contents(self, os.path.join(self.source_folder, sources["folder"]), self.source_folder) def build(self): @@ -598,7 +598,7 @@ def source(self): # Final we want is pkg/ and common/ # NOTE: This abs_path is IMPORTANT to avoid the trailing "." src_folder = os.path.abspath(self.source_folder) - move_folder_contents(src_folder, os.path.dirname(src_folder)) + move_folder_contents(self, src_folder, os.path.dirname(src_folder)) def build(self): cmake = CMake(self)