#!/bin/sh REPOS="$1" REV="$2" SSH="host" SSH_PATH="/var/www/localhost/htdocs" file_list=`svnlook changed -r $REV $REPOS | awk '{print $1 ":" $2}'` tmpdir="/tmp/svn2sftp.$RANDOM" while [ -e $tmpdir ] do tmpdir="/tmp/svn2sftp.$RANDOM" done svn export -r $REV file://$REPOS $tmpdir >/dev/null cd $tmpdir for a in $file_list do filename=`echo $a | awk -F ':' '{print $2}'` case `echo $a | awk -F ':' '{print $1}'` in ['U','UU','A']) listupload+="$filename ";; 'D') listremove+="$filename ";; esac done if [ "$listupload" ] then tar -cO --no-recursion $listupload | ssh $SSH "cd $SSH_PATH && tar -x" fi if [ "$listremove" ] then ssh $SSH "cd $SSH_PATH && rm -rf $listremove" fi rm -rf $tmpdir