#!/bin/bash # Write a Subversion log message template to stdout. List the files that would # be committed and attempt to list the names of functions changed. (The listing # of functions is very unreliable.) Add a full diff for review and reference. # Usage: $0 [dir/file...] # Get a list of the files (and dirs) affected. FILES=`svn st "$@" | grep -v -E "^(\?| L|X|Performing|DBG:|$)" | sed 's/^.......//' | sort` echo # List the files affected, and attempt to list the functions affected. for FILE in $FILES; do echo "* $FILE" # Find the names of the functions affected, and list them in parentheses. # Diff with no context ('-U0') to get more accurate function names. svn diff --depth=empty --diff-cmd diff -x '-U0 -p' "$FILE" | sed -e "s/^@@ [^@]* @@ .*\<\(\([A-Za-z_][A-Za-z0-9_]*\) *(.*\|struct \([A-Za-z_][A-Za-z0-9_]*\)$\)/ (\2\3): /" -e "t" -e "d" | uniq echo done # Ensure svn doesn't include the diff with the log message when committing. echo '--This line, and those below, will be ignored--' echo # Append the diff. Call 'svn diff' for each file separately, to get them # in the same order as the list above. for FILE in $FILES; do svn diff --depth=empty --diff-cmd diff -x -pu "$FILE" done