After nearly losing all my work yesterday, I've made this little script to run in the Emacs compile buffer before the make command. This runs svn diff every time I compile and puts the result into a separate directory.
#!/bin/sh
CURRENT_DIR=`pwd`
DATE_MARKER=$(date +%Y%m%d%T)
SECURITY_PATCH_DIR=/home/g/security_patches/
WHAT=`echo "${CURRENT_DIR##*/}"`
EXT=.patch
SECURITY_DIFF=${SECURITY_PATCH_DIR}${WHAT}${DATE_MARKER}${EXT}
SVN=/home/g/InstalledSVN1.9/subversion
$SVN diff > $SECURITY_DIFF