#!/bin/sh # svn2git comes from: http://gitorious.org/svn2git/svn2git (devel/svn2git) # Do not remove log-area51 as it is used for syncing AREA51=${AREA51:-https://area51.pcbsd.org/} SVNSYNC=${SVNSYNC:-$HOME/.area51/area51-mirror} BASE=`dirname $0` mirror() { # Mirror area51 if [ ! -d ${SVNSYNC} ] then mkdir ${SVNSYNC} svnsync file://${SVNSYNC} ${AREA51} fi if ! svnsync sync file://${SVNSYNC} then echo "Failed to mirror ${AREA51}" exit 2 fi # Convert to git if ! svn2git --identity-map=$BASE/authors.txt --rules=$BASE/rules.txt --stats ${SVNSYNC} --max-rev 7000 then echo "Failed to export to git" exit 1 fi } sync() { OLDREV=`svnsync info file://${SVNSYNC} | tail -n 1 | cut -f 4 -d ' '` if ! svnsync --username=DragonSA sync file://${SVNSYNC} then echo "Failed to synchronise ${AREA51}" exit 2 fi NEWREV=`svnsync info file://${SVNSYNC} | tail -n 1 | cut -f 4 -d ' '` if [ $NEWREV != $OLDREV ] then if ! svn2git --resume-from=$(($OLDREV + 1)) --identity-map=$BASE/authors.txt --rules=$BASE/rules.txt --stats ${SVNSYNC} then echo "Failed to export to git" exit 1 fi fi } if [ -d ${SVNSYNC} -a -d area51 ] then sync else mirror fi