#!/bin/sh

if [ $# -eq 0 ]; then
    cat <<EOF
Usage:
    svnlastchange <filename> [<filename> ...]

EOF
    exit 1
fi

if [ "$1" == "-q" ]; then
    shift
else
    echo >/dev/tty "Hint: Use svn log -r COMMITTED and svn diff -r PREV:COMMITTED"
fi

svn log -r COMMITTED "$*"
svn diff -r PREV:COMMITTED "$*" || \
    echo >&2 "Error retrieving diff: the file was probably added in the last revision"