Home > Uncategorized > Forbid modification of tags in subversion

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

Advertisements
Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: