From dd3b8dd21957d4a5d9f2c68a547e984bdf465b63 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 27 Jan 2017 02:50:22 +0300 Subject: In packages move branch name into DEFAULT_BRANCH variable. By default this variable set to "master". --- scripts/include/common.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/include/common.sh b/scripts/include/common.sh index 2afe31c..d4a7ec8 100644 --- a/scripts/include/common.sh +++ b/scripts/include/common.sh @@ -56,6 +56,7 @@ function common_package_init { export packagefile="${package}.sh" export SRCTYPE="git" + export DEFAULT_BRANCH="master" if [ ! -f "../packages/${packagefile}" ]; then echo "Error: Package '${package}' not exists." @@ -190,14 +191,24 @@ function run_hg_switch_branch { } function run_switch_branch { + branch="$1" + if [[ "${DEFAULT_BRANCH}" == "" ]]; then + echo "Error: source branch not set." + exit 1 + fi + if [[ "${branch}" == "" ]]; then + branch="${DEFAULT_BRANCH}" + fi + if [[ "${SRCTYPE}" == "git" ]]; then - run_git_switch_branch $1 + run_git_switch_branch ${branch} elif [[ "${SRCTYPE}" == "hg" ]]; then - run_hg_switch_branch $1 + run_hg_switch_branch ${branch} else echo "Error: unknown SRCTYPE: ${SRCTYPE}" exit 1 fi + unset branch } function repack_paths { -- cgit v1.2.3-60-g2f50