svn export changed files per revision
this little script tool will export a whole tree of revisions, whith only the changed files in every directory.
first some script that exports a specific revision to a directory:
exportrev.sh:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/bin/bash REPO=https://svn.your-url.com/repos/your-repo EXPORTDIR=/var/www/your/directory REV=$1 REVF=$(printf "%04d" $REV) REVDIR=$EXPORTDIR/$REVF if [ -d $REVDIR ] ; then echo "revision $REV already exists, skipping ..." # fix links ... ln -s $REVDIR/log.txt $REVDIR/HEADER.txt >> /dev/null 2>&1 exit 0 fi mkdir $REVDIR >> /dev/null 2>&1 REVCHANGES=$(svn diff --summarize -r $[$REV -1]:$REV $REPO | grep -v 'D ' | awk '{ print $2 }') if [[ "$REVCHANGES" != "" ]] ; then for i in $REVCHANGES do p=$(echo $i | sed -e "s{$REPO{{") dn=$REVDIR/$(dirname $p) fn=$REVDIR/$p mkdir -p $dn >> /dev/null 2>&1 svn export -r $REV --force $i $fn >> /dev/null 2>&1 done fi svn log -v -r $[$REV]:$[$REV] $REPO > $REVDIR/log.txt ln -s $REVDIR/log.txt $REVDIR/HEADER.txt >> /dev/null 2>&1 chown lighttpd:lighttpd $REVDIR -R |
then a script that goes through all revisions of a repo:
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash REPO=https://svn.your-url.com/repos/your-repo REV_MAX=$(svn info $REPO | grep 'Revision' | awk '{ print $2 }') REV_MAX=$REV_MAX for REV in $(seq $REV_MAX) do /path/to/XXXXXXX/exportrev.sh $REV echo $REV done |
just change the big variables in the script header and some paths and youre done ![]()
(you can always call export.sh since it ignores existing directories - thus no slowdow)
Can you provide a brief explanantion of how to run your script, and which (big) variables and paths need to be changed?