Jepp, no more these projects
[jprojects-scripts.git] / push-stick.sh
index 4a8ca0961d85ff2e84b0582e802edef09a68ebf3..f3e72c19336725eeef22ac917a0b8003992406b6 100755 (executable)
@@ -2,38 +2,63 @@
 
 . ./.jprojects.sh || exit 255
 
-TARGETS="d t u"
+TARGETS="d t u"
 
 if [ "$1" = "a" ]
 then
        cd "${JPROJECTS_HOME}"
        for TARGET in ${TARGETS}; do
                echo "$0: Pushing for target '${TARGET}' ..."
-               $0 "${TARGET}" "1"
+               $0 "${TARGET}" "$2"
        done
 
        echo "$0: Pushed to all targets."
        exit 0
 fi
 
-for ENTRY in ${LIST}; do
-       echo "$0: Pushing '${ENTRY}' ..."
-       cd "${JPROJECTS_HOME}/${ENTRY}" || exit 255
-
-       if [ -z "$2" ]
+for project in ${LIST}; do
+       if [ ! -d "${JPROJECTS_HOME}/${project}" ]
        then
-               git push --all
+               echo "$0: Project '${project}' does not exist."
+               continue;
        fi
 
+       echo "$0: Processing '${project}',mode='$1' ..."
+       cd "${JPROJECTS_HOME}/${project}" || exit 255
+
        if [ "$1" = "d" ]
        then
-               git push --all daedalus
+               if [ -n "$2" ]
+               then
+                       git push daedalus :"$2"
+               fi
+
+               git push --all daedalus || exit 255
        elif [ "$1" = "t" ]
        then
-               git push --all transport
+               if [ -n "$2" ]
+               then
+                       git push transport :"$2"
+               fi
+
+               git push --all transport || exit 255
        elif [ "$1" = "u" ]
        then
-               git push --all upstream
+               if [ -n "$2" ]
+               then
+                       git push upstream :"$2"
+               fi
+
+               git push --all upstream || exit 255
+       else
+               if [ -n "$2" ]
+               then
+                       git push origin :"$2"
+               fi
+
+               git push --all || exit 255
        fi
-       cd "${JPROJECTS_HOME}"
 done
+
+echo "$0: All done."
+exit 0