From: Baris Metin Date: Thu, 17 Jun 2010 16:48:36 +0000 (+0200) Subject: Merge branch 'master' of git.onelab.eu:/git/infrastructure X-Git-Tag: foo~110 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b1b080f53e1d319214aa62a996ff9706a7ca7d97;hp=8763edd27e319e7fed850a9e0f02ce50209d1969;p=infrastructure.git Merge branch 'master' of 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 +