From: Roland Häder Date: Sat, 5 Oct 2019 00:27:40 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5a0a15fe33c9131171c9222e699c6183d096db2e;p=jprojects-scripts.git Continued: - added "backup2" in fix-project-remotes.sh - rewrote cherry-jprojects.sh a bit, because the variable assignment can be done below first 2 if-blocks Signed-off-by: Roland Häder --- diff --git a/cherry-jprojects.sh b/cherry-jprojects.sh index c04438e..1ecb794 100755 --- a/cherry-jprojects.sh +++ b/cherry-jprojects.sh @@ -3,8 +3,6 @@ . ./.jprojects.sh || exit 255 for project in ${LIST}; do - COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits" - if [ "${project}" = "jprojects-scripts" ] then echo "$0: Skipping jprojects-scripts ..." @@ -13,7 +11,11 @@ for project in ${LIST}; do then echo "$0: Project '${project}' does not exist." continue - elif [ ! -f "${COMMITS_FILE}" ] + fi + + COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits" + + if [ ! -f "${COMMITS_FILE}" ] then # No .gitcommits file, skip this silently continue diff --git a/fix-project-remotes.sh b/fix-project-remotes.sh index a9a9288..773330d 100755 --- a/fix-project-remotes.sh +++ b/fix-project-remotes.sh @@ -6,6 +6,7 @@ UNWANTED_NAME="stick" WANTED_NAME1="upstream" WANTED_NAME2="daedalus" WANTED_NAME3="transport" +WANTED_NAME4="backup2" GIT_USER="quix0r" GIT_SERVER="git.mxchange.org" @@ -16,6 +17,7 @@ GIT_ORIGIN="origin" MEDIA_BASE="/media" MEDIA_NAME1="Backup" MEDIA_NAME2="Transport" +MEDIA_NAME3="Backup" MEDIA_PATH="Java Project" for project in ${LIST}; do @@ -38,12 +40,14 @@ for project in ${LIST}; do GIT_URL4="file:///E:/Java%20Project/${project}.git" GIT_URL5="E:/Java Project/${project}.git" GIT_URL6="${MEDIA_BASE}/${USER}/${MEDIA_NAME1}/${MEDIA_PATH}/${project}.git" + GIT_URL7="${MEDIA_BASE}/${USER}/${MEDIA_NAME3}/${MEDIA_PATH}/${project}.git" echo "$0: GIT_URL1='${GIT_URL1}'" echo "$0: GIT_URL2='${GIT_URL2}'" echo "$0: GIT_URL3='${GIT_URL3}'" echo "$0: GIT_URL4='${GIT_URL4}'" echo "$0: GIT_URL5='${GIT_URL5}'" echo "$0: GIT_URL6='${GIT_URL6}'" + echo "$0: GIT_URL7='${GIT_URL7}'" if [ "$1" = "l" ] then @@ -64,6 +68,7 @@ for project in ${LIST}; do git remote add "${WANTED_NAME1}" "${GIT_URL1}" git remote add "${WANTED_NAME2}" "${GIT_URL2}" git remote add "${WANTED_NAME3}" "${GIT_URL3}" + git remote add "${WANTED_NAME4}" "${GIT_URL4}" else echo "$0: Don't know how to create repositories, maybe unsupported." exit 1 @@ -170,7 +175,8 @@ for project in ${LIST}; do UPSTREAM_REMOTE1=$(git remote | grep "${WANTED_NAME1}") UPSTREAM_REMOTE2=$(git remote | grep "${WANTED_NAME2}") UPSTREAM_REMOTE3=$(git remote | grep "${WANTED_NAME3}") - echo "$0: UPSTREAM_REMOTE1='${UPSTREAM_REMOTE1}',UPSTREAM_REMOTE2='${UPSTREAM_REMOTE2}',UPSTREAM_REMOTE3='${UPSTREAM_REMOTE3}'" + UPSTREAM_REMOTE4=$(git remote | grep "${WANTED_NAME4}") + echo "$0: UPSTREAM_REMOTE1='${UPSTREAM_REMOTE1}',UPSTREAM_REMOTE2='${UPSTREAM_REMOTE2}',UPSTREAM_REMOTE3='${UPSTREAM_REMOTE3},UPSTREAM_REMOTE4='${UPSTREAM_REMOTE4}'" if [ -n "${UPSTREAM_REMOTE1}" ] then @@ -202,6 +208,17 @@ for project in ${LIST}; do echo "$0: No wanted '${WANTED_NAME3}' in '${project}'. Adding ..." git remote add "${WANTED_NAME3}" "${GIT_URL3}" --track "${GIT_BRANCH}" || exit 255 fi + + if [ -n "${UPSTREAM_REMOTE4}" ] + then + echo "$0: Remote '${WANTED_NAME4}' found in '${project}'." + elif [ ! -d "${GIT_URL4}" ] + then + echo "$0: Remote '${WANTED_NAME4}' cannot be created, path '${GIT_URL4}' missing." + else + echo "$0: No wanted '${WANTED_NAME4}' in '${project}'. Adding ..." + git remote add "${WANTED_NAME4}" "${GIT_URL4}" --track "${GIT_BRANCH}" || exit 255 + fi fi echo "$0: Setting upstream to '${GIT_ORIGIN}/${GIT_BRANCH}' ..."