Re-design of submodules used in blender.git #104755

Merged
Sergey Sharybin merged 12 commits from Sergey/blender:submodules_refactor into blender-v3.5-release 2023-02-21 16:40:14 +01:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit cf811e69af - Show all commits

9
.gitignore vendored
View File

@ -56,3 +56,12 @@ waveletNoiseTile.bin
# External repositories.
/scripts/addons
/scripts/addons-contrib
# Ignore old submodules directories.
# Eventually need to get rid of those, but for the first time of transition
# avoid indidents when the folders exists after bisect and developers staging
# them by accident.
/release/scripts/addons
/release/datafiles/locale/
/release/scripts/addons_contrib/
/source/tools/
Sergey marked this conversation as resolved

As far as I can tell the trailing slashes make no difference, but maybe best to leave them out for consistency.

As far as I can tell the trailing slashes make no difference, but maybe best to leave them out for consistency.
Review

We quickly talked about this with Brecht. Decided to add them everywhere instead. Seems to be that in the current state of .gitignore we use the trailing slash more than we don't :)

We quickly talked about this with Brecht. Decided to add them everywhere instead. Seems to be that in the current state of .gitignore we use the trailing slash more than we don't :)

View File

@ -278,10 +278,10 @@ def external_script_copy_old_submodule_over(args: argparse.Namespace, directory_
external_dir = scripts_dir / directory_name
old_submodule_relative_dir = Path("release") / "scripts" / directory_name
print(f"Copying {old_submodule_relative_dir} to scripts/{directory_name} ...")
print(f"Moving {old_submodule_relative_dir} to scripts/{directory_name} ...")
old_submodule_dir = blender_git_root / old_submodule_relative_dir
shutil.copytree(old_submodule_dir, external_dir)
shutil.move(old_submodule_dir, external_dir)
# Remove old ".git" which is a file with path to a submodule bare repo inside of main
# repo .git/modules directory.
@ -302,6 +302,7 @@ def external_script_initialize_if_needed(args: argparse.Namespace,
"""Initialize checkout of an external repository scripts directory"""
blender_git_root = Path(get_blender_git_root())
blender_dot_git = blender_git_root / ".git"
scripts_dir = blender_git_root / "scripts"
external_dir = scripts_dir / directory_name
@ -311,7 +312,7 @@ def external_script_initialize_if_needed(args: argparse.Namespace,
print(f"Initializing scripts/{directory_name} ...")
old_submodule_dot_git = blender_git_root / "release" / "scripts" / directory_name / ".git"
if old_submodule_dot_git.exists():
if old_submodule_dot_git.exists() and blender_dot_git.is_dir():
external_script_copy_old_submodule_over(args, directory_name)
return