Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-09-20 14:17:01 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-09-20 15:05:56 +0300
commitda4796ebf7ea728dc81ff4b3c62410230520977a (patch)
treef0a453cf2de6866804b74c2798622466cc7f40fc /build_files/utils/make_update.py
parentfc4f82d2004c843691d81afff0f7abb38caace0a (diff)
Build: change make update to not print errors regarding submodule branches
Instead of trying to checkout non-existent branches and getting confusing fatal error prints, check if the branch exists first. Ref D12560
Diffstat (limited to 'build_files/utils/make_update.py')
-rwxr-xr-xbuild_files/utils/make_update.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index f653639ec6d..30ef090efbb 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -200,16 +200,20 @@ def submodules_update(args, release_version, branch):
if msg:
skip_msg += submodule_path + " skipped: " + msg + "\n"
else:
- # We are using `exit_on_error=False` here because sub-modules are allowed to not have requested branch,
- # in which case falling back to default back-up branch is fine.
- if make_utils.git_branch(args.git_command) != submodule_branch:
- call([args.git_command, "fetch", "origin"])
- call([args.git_command, "checkout", submodule_branch], exit_on_error=False)
- call([args.git_command, "pull", "--rebase", "origin", submodule_branch], exit_on_error=False)
- # If we cannot find the specified branch for this submodule, fallback to default one (aka master).
- if make_utils.git_branch(args.git_command) != submodule_branch:
- call([args.git_command, "checkout", submodule_branch_fallback])
- call([args.git_command, "pull", "--rebase", "origin", submodule_branch_fallback])
+ # Find a matching branch that exists.
+ call([args.git_command, "fetch", "origin"])
+ if make_utils.git_branch_exists(args.git_command, submodule_branch):
+ pass
+ elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback):
+ submodule_branch = submodule_branch_fallback
+ else:
+ submodule_branch = None
+
+ # Switch to branch and pull.
+ if submodule_branch:
+ if make_utils.git_branch(args.git_command) != submodule_branch:
+ call([args.git_command, "checkout", submodule_branch])
+ call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
finally:
os.chdir(cwd)