diff options
Diffstat (limited to 'scripts/include')
-rw-r--r-- | scripts/include/common.sh | 15 |
1 files changed, 13 insertions, 2 deletions
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 { |