From 9cd8cd2a0435444677e7176459be0d9076d3588f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Wed, 11 Jan 2017 13:46:24 +0200 Subject: prepare_coin_sources: Use dev branch as a default branch Use dev branch if given --branch option contains not existing branch. Change-Id: I21b0a1b9007407f30f899091de5a859fac0059f4 Reviewed-by: Friedemann Kleint --- prepare_coin_sources.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/prepare_coin_sources.py b/prepare_coin_sources.py index 15cc96f3d..718f14f7d 100644 --- a/prepare_coin_sources.py +++ b/prepare_coin_sources.py @@ -106,12 +106,19 @@ def prepare_sources(): else: module_dir = os.path.join("sources", module_name) os.chdir(module_dir) - print("Checking out submodule %s to branch %s" % (module_name, SUBMODULE_BRANCH)) - git_checkout_cmd = ["git", "checkout", SUBMODULE_BRANCH] + #Make sure the branch exists, if not use dev + _branch = SUBMODULE_BRANCH + git_list_branch_cmd = ["git", "branch", "--list", _branch] + if len(run_process_output(git_list_branch_cmd))==0: + print("Warning: Requested %s branch doesn't exist so we'll fall back to 'dev' branch instead"\ + % SUBMODULE_BRANCH) + _branch = "dev" + print("Checking out submodule %s to branch %s" % (module_name, _branch)) + git_checkout_cmd = ["git", "checkout", _branch] if run_process(git_checkout_cmd) != 0: print("Failed to initialize the git submodule %s" % module_name) else: - print("Submodule %s has branch %s checked out" % (module_name, SUBMODULE_BRANCH)) + print("Submodule %s has branch %s checked out" % (module_name, _branch)) os.chdir(script_dir) -- cgit v1.2.3