#!/bin/bash # Configure where these executables are on your system. # Note that the expression passed to sed only seems to work with GNU sed and not # BSD sed which is included with Mac OS X. I do not know what that's all about. SVNLOOK=/opt/local/bin/svnlook SED=/opt/local/bin/sed # Arguments passed to the script. REPO="$1" TXN="$2" # Get the list of files (but not directories) that were added or whose properties were modified. the_files=`$SVNLOOK changed -t "$TXN" "$REPO" | $SED -n 's/^\(A\|.U\)\s*\(.*[^/]\)$/\2/p'` for a_file in $the_files; do # Attempt to get the svn:needs-lock property. $SVNLOOK propget -t "$TXN" "$REPO" svn:needs-lock "$a_file" >/dev/null 2>&1 # Exit and alert if an error occurred doing that. if [ $? -ne 0 ]; then echo "File $a_file doesn't have the svn:needs-lock property set." 1>&2 echo "Repository policy dictates that all files must set the svn:needs-lock property." 1>&2 exit 1 fi done # If we haven't exited by now, everything must be fine. exit 0