Forbid modification of tags in subversion
Here is my pre-commit script to forbid modification of tags in subversion. I adapted from one posted by Wolfgang Fritz on a mailing list:.
REPOS="$1"
TXN="$2"
export LC_ALL=C
# Check for modification of tags.
# Reject tag modifications except creation and deletion
SVNLOOK=/usr/bin/svnlook
$SVNLOOK changed -t “$TXN” “$REPOS” | egrep -v “^[AD][[:space:]]+(.*/)?tags/[^/]+/$” | egrep “^[^[:space:]]+[[:space:]]+tags/[^/]+/.+”
if [ $? -eq 0 ] ; then
echo >&2 “***************************************”
echo >&2 “* Modification of tags is not allowed *”
echo >&2 “***************************************”
exit 1
fi
#
# Make sure that the log message contains some text.
$SVNLOOK log -t “$TXN” “$REPOS” | grep “[a-zA-Z0-9]“
if [ $? -ne 0 ] ; then
echo >&2 “**************************************************”
echo >&2 “* You must give a meaningful comment for commits *”
echo >&2 “**************************************************”
exit 1
fi
exit 0