From 81db1e1f3653c7f9917cad1368993ba34bc407dd Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 1 Jun 2016 22:09:50 +0200 Subject: [PATCH] added script for half-automated cherry-picking all projects Signed-off-by: Roland Haeder --- cherry-jprojects.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 cherry-jprojects.sh diff --git a/cherry-jprojects.sh b/cherry-jprojects.sh new file mode 100755 index 0000000..ef82bae --- /dev/null +++ b/cherry-jprojects.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +. ./.jprojects.sh || exit 255 + +for project in ${LIST}; do + if [ "${project}" = "jprojects-scripts" ] + then + echo "$0: Skipping jprojects-scripts ..." + continue + elif [ ! -d "${JPROJECTS_HOME}/${project}" ] + then + echo "$0: Project '${project}' does not exist." + continue + elif [ ! -f "${JPROJECTS_HOME}/${project}/.gitcommits" ] + then + # No .gitcommits file, skip this silently + continue + fi + + COMMIT_IDS=`cat "${JPROJECTS_HOME}/${project}/.gitcommits"` + COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits" + + echo "$0: Cherry-picking on project '${project}' ..." + for commit in ${COMMIT_IDS}; do + cd "${JPROJECTS_HOME}/${project}" + echo "$0: Working on commit '${commit}' ..." + FOUND_ID=`git rev-list "${commit}" --max-count=1 2>&1` + STATUS="$?" + + if [ "${STATUS}" != "0" ] + then + echo "$0: Found invalid commit id '${commit}' or status '${STATUS}'." + echo "$0: Maybe forgot git-remote add -local ?" + exit 1 + fi + + git cherry-pick -S "${commit}" || exit 255 + + echo "$0: Removing commit from list ..." + REMAINING_IDS=`cat ${COMMITS_FILE} | grep -v "${commit}"` + echo "${REMAINING_IDS}" > ${COMMITS_FILE} + done + + rm -f "${COMMITS_FILE}" +done + +echo "$0: All done." +exit 0 -- 2.30.2