From: Thierry Parmentelat Date: Fri, 18 Jun 2010 07:35:18 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.onelab.eu/git/infrastructure X-Git-Tag: foo~108^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c489820d558b5abea0579e9eb12a17ae435296d7;hp=d0124f9b8e0b89447524629eef76876080cab9d6;p=infrastructure.git Merge branch 'master' of ssh://git.onelab.eu/git/infrastructure --- diff --git a/scripts/git-mirror.sh b/scripts/git-mirror.sh new file mode 100644 index 0000000..434b7e8 --- /dev/null +++ b/scripts/git-mirror.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +MIRROR="git://git.planet-lab.org" +LOCAL="/git" + +function mirror () { + for arg in "$@" ; do + REPO=${arg} + REPO_NAME=${REPO}.git + MIRROR_REPO=${MIRROR}/${REPO_NAME} + LOCAL_REPO=${LOCAL}/${REPO_NAME} + + if [ -d ${REPO} ] + then + echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx pulling from ${REPO_NAME}" + pushd ${REPO} + git pull --tags + git pull + popd + else + echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mirroring in ${REPO_NAME} for the first time" + git clone ${MIRROR_REPO} + pushd ${REPO} + git remote add local_master ${LOCAL_REPO} + popd + fi + + echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx pushing ${REPO_NAME} to local master" + pushd ${REPO} + git push local_master + git push --tags local_master + popd + done +} + +args="$@" +[[ -z "$args" ]] && args=$(ls /svn) + +mirror $args +