From 93abd1671edafaf39d50b9d87acf7f4c924abcc1 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 13 Jan 2014 17:26:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20push-upd?= =?UTF-8?q?ate=20(=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE,=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B0=D1=8E=D1=89=D0=B8?= =?UTF-8?q?=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push-update.sh | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/push-update.sh b/push-update.sh index 22af8bf..ba5468b 100755 --- a/push-update.sh +++ b/push-update.sh @@ -24,13 +24,14 @@ VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1` if [ `git rev-parse ${VERSION_PREVIOUS}` != `git rev-parse HEAD` ] then VERSION=`echo ${VERSION_PREVIOUS} | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'` - git tag $VERSION && + git tag "$VERSION" && gitchangelog > CHANGELOG.md && - (git add CHANGELOG.md > /dev/null && - git commit -m 'Update CHANGELOG.md' > /dev/null && - git push --tags > /dev/null) || - (echo -e "Cannot push released tag into remote repository\n" && - exit 1) + { git add CHANGELOG.md > /dev/null && + git commit -m "Update CHANGELOG.md" > /dev/null && + git tag "$VERSION" && + git push --tags >/dev/null 2>/dev/null; } || + { echo -e "Cannot push released tag into remote repository\n" && + exit 1; } else VERSION=$VERSION_PREVIOUS fi @@ -41,31 +42,29 @@ CURRENT_DIR=`pwd` for project in "${PROJECTS[@]}" do echo -e "Update lib for ${project}...\n" - (cd "${project}${PATH_LIB}" && + {cd "${project}${PATH_LIB}" && git fetch >/dev/null 2>/dev/null && - git checkout $VERSION 2>/dev/null) || - (echo -e "Failed to checkout lib on tag ${VERSION}\n" && - exit 1) + git checkout $VERSION 2>/dev/null; } || + { echo -e "Failed to checkout lib on tag ${VERSION}\n" && + exit 1; } cd "${project}" LIB_DIR=`echo ${PATH_LIB#'/'}` git diff-index --quiet HEAD "$LIB_DIR" LIB_NEW_COMMITS=`echo $?` if [ $LIB_NEW_COMMITS == 1 ] then - echo -e "`pwd`\n" - exit 1 - (git reset > /dev/null && + { git reset > /dev/null && git add "$LIB_DIR" > /dev/null && - git commit -m $MESSAGE > /dev/null) || - (echo -e "Failed to update lib for ${project}\n" && - exit 1) + git commit -m "$MESSAGE" > /dev/null; } || + { echo -e "Failed to update lib for ${project}\n" && + exit 1; } if [ $project == "/var/www/d753_common" ] then - (git push origin master > /dev/null && + { git push origin master > /dev/null && cd /var/www/d753/ && ./merge-from-master.sh > /dev/null - cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null) || - (echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" && - exit 1) + cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null; } || + { echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" && + exit 1; } fi else echo -e "Already update\n"