--- /dev/null
+#!/bin/bash
+
+self=`basename $0`
+version=$1
+branch=$2
+user=$3
+action=$4
+tagForVersion=v${version}
+
+###############################################################################
+
+declare -a repositories=(
+ "simantics/third-party.git" "third-party"
+ "simantics/platform.git" "platform"
+ "simantics/fmil.git" "fmil"
+ "simantics/interop.git" "interop"
+ "simantics/district.git" "district"
+ "simantics/matlab.git" "matlab"
+ "simantics/python.git" "python"
+ "simantics/r.git" "r"
+ "simantics/sysdyn.git" "sysdyn"
+ "members/fmi.git" "fmi"
+ "members/simupedia.git" "simupedia"
+)
+
+repositoryCount=$((${#repositories[@]} / 2))
+
+function repo {
+ eval $1=\${repositories[$(($2 * 2))]}
+}
+
+function localPath {
+ eval $1=\${repositories[$(($2 * 2 + 1))]}
+}
+
+###############################################################################
+
+function msg {
+ echo "[$(($1+1))/${repositoryCount}] $2"
+}
+
+function clone {
+ echo "git clone ssh://${user}@www.simantics.org:29418/$1"
+ git clone ssh://${user}@www.simantics.org:29418/$1
+}
+
+function branch {
+ echo "git branch $1"
+ git branch $1
+}
+
+function fetch {
+ echo "git fetch --all"
+ git fetch --all
+}
+
+function pull {
+ echo "git pull --all"
+ git pull --all
+}
+
+function pushBranch {
+ echo "git push origin $1"
+ git push origin $1
+}
+
+function checkout {
+ echo "git checkout $1"
+ git checkout $1
+}
+
+function tag {
+ echo "git tag $1 -m \"Simantics $1 simultaneous release\""
+ git tag $1 -m "Simantics $1 simultaneous release"
+}
+
+function removeTag {
+ echo "git tag -d $1"
+ git tag -d $1
+}
+
+function pushTags {
+ echo "git push origin --tags"
+ git push origin --tags
+}
+
+function status {
+ git status
+}
+
+function listTags {
+ git tag -l
+}
+
+function listBranches {
+ git branch -a
+}
+
+###############################################################################
+
+case "$action" in
+ clone)
+ mkdir -p $version
+ pushd $version > /dev/null
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ repo p $i
+ msg $i "Clone $p"
+ clone $p
+ done
+ popd > /dev/null
+ exit 0
+ ;;
+esac
+
+pushd $version > /dev/null
+case "$action" in
+ branch)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Create $branch branch in $lp"
+ pushd $lp > /dev/null
+ branch $branch
+ popd > /dev/null
+ done
+ ;;
+ checkout)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Checkout $branch branch in $lp"
+ pushd $lp > /dev/null
+ checkout $branch
+ popd > /dev/null
+ done
+ ;;
+ tag)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Tag ${version} for $lp"
+ pushd $lp > /dev/null
+ checkout $branch
+ tag ${tagForVersion}
+ popd > /dev/null
+ done
+ ;;
+ list-branches)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "List branches in $lp"
+ pushd $lp > /dev/null
+ listBranches
+ popd > /dev/null
+ done
+ ;;
+ list-tags)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "List tags in $lp"
+ pushd $lp > /dev/null
+ listTags
+ popd > /dev/null
+ done
+ ;;
+ remove-tag)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Remove tag $tagForVersion from $lp"
+ pushd $lp > /dev/null
+ removeTag ${tagForVersion}
+ popd > /dev/null
+ done
+ ;;
+ fetch)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Fetch from remote origin in $lp"
+ pushd $lp > /dev/null
+ fetch
+ popd > /dev/null
+ done
+ ;;
+ pull)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Pull from remote origin in $lp"
+ pushd $lp > /dev/null
+ pull
+ popd > /dev/null
+ done
+ ;;
+ push)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Push branch $branch to remote origin in $lp"
+ pushd $lp > /dev/null
+ pushBranch $branch
+ popd > /dev/null
+ done
+ ;;
+ push-tags)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Push tags to remote origin in $lp"
+ pushd $lp > /dev/null
+ pushTags
+ popd > /dev/null
+ done
+ ;;
+ status)
+ for (( i=0; i<${repositoryCount}; i++ )); do
+ localPath lp $i
+ msg $i "Status of $lp"
+ pushd $lp > /dev/null
+ status
+ popd > /dev/null
+ done
+ ;;
+ *)
+ echo "Usage: ${self} <version> <branch-name> <user-name> clone|branch|checkout|fetch|list-tags|pull|push|push-tags|remove-tag|status|tag"
+
+ ;;
+esac