aboutsummaryrefslogtreecommitdiffstats
path: root/prepare_coin_sources.py
diff options
context:
space:
mode:
authorSimo Fält <simo.falt@qt.io>2017-01-11 13:46:24 +0200
committerSimo Fält <simo.falt@qt.io>2017-01-12 06:01:54 +0000
commit9cd8cd2a0435444677e7176459be0d9076d3588f (patch)
tree7e7d93ded1520ee96cb3df3f4ca930ed140c18aa /prepare_coin_sources.py
parent75e10f10c1b8bb305a02beafab679100a0725d3a (diff)
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 <Friedemann.Kleint@qt.io>
Diffstat (limited to 'prepare_coin_sources.py')
-rw-r--r--prepare_coin_sources.py13
1 files 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)