Skip to content

Instantly share code, notes, and snippets.

@fboiton
Created May 31, 2011 17:39
Show Gist options
  • Save fboiton/1000941 to your computer and use it in GitHub Desktop.
Save fboiton/1000941 to your computer and use it in GitHub Desktop.
extract svn revision files
#!/bin/bash
if [ $# -lt 4 ]; then
echo "This script needs 4 parameters as follows:"
echo "./getFilesToUpload.sh [root svn path] [internal svn path] [revision(s) - ARG1:ARG2 for ranges] [output folder]"
exit 0
fi
ROOTSVNPATH=$1
INTERNALSVNPATH=$2
REVISIONS=$3
OUTPUTFOLDER=$4
# please if there is another folder in the base structure, it should be included in the egrep: egrep "(/trunk/|/www/|/wordpress/|/database/|/outsite/)" with both "/" in the beginning and the end of the word...
FLIST=`svn log -r$REVISIONS -v $ROOTSVNPATH$INTERNALSVNPATH | egrep " M | A " | egrep "(/trunk/www/|/wordpress/|/database/)" | egrep -v "/hif-site$" | awk '{print $2}' | sort | uniq`
for i in $FLIST
do
DEST="$OUTPUTFOLDER$i"
mkdir -p ${DEST%/*}
echo "exported file $ROOTSVNPATH$i to $OUTPUTFOLDER$i from revision $REVISIONS"
svn export -r$REVISIONS $ROOTSVNPATH$i $OUTPUTFOLDER$i --force
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment