Mike Mason wrote:
> Wolfgang Fritz wrote:
>> But I had not read your regular expression correctly. I've tested it
>>with the "svnlook changed" output and it prints only the "forbidden"
>>actions inside the tags/tag1 subdirectory. So it seems to do the correct
>>It allows tag creation, tag deletion and tag renames like CVS.
> Hi Wolfgang,
> That script sounds really useful - do you have plans to make it
> publically available? (..and is there a good place for this kind of
> utility script? Perforce has a public depot with things like this in it).
since I have no publically accessible web space available, I post the
script here (see attachment).
# PRE-COMMIT HOOK
# The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#  REPOS-PATH (the path to this repository)
#  TXN-NAME (the name of the txn about to be committed)
# The default working directory for the invocation is undefined, so
# the program should set one explicitly if it cares.
# If the hook program exits with success, the txn is committed; but
# if it exits with failure (non-zero), the txn is aborted, no commit
# takes place, and STDERR is returned to the client. The hook
# program can use the 'svnlook' utility to help it examine the txn.
# On a Unix system, the normal procedure is to have 'pre-commit'
# invoke other programs to do the real work, though it may do the
# work itself too.
# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***
# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***
# This is why we recommend using the read-only 'svnlook' utility.
# In the future, Subversion may enforce the rule that pre-commit
# hooks should not modify the versioned data in txns, or else come
# up with a mechanism to make it safe to do so (by informing the
# committing client of the changes). However, right now neither
# mechanism is implemented, so hook writers just have to be careful.
# Note that 'pre-commit' must be executable by the user(s) who will
# invoke it (typically the user httpd runs as), and that user must
# have filesystem-level permission to access the repository.
# On a Windows system, you should name the hook program
# 'pre-commit.bat' or 'pre-commit.exe',
# but the basic idea is the same.
# Here is an example hook script, for a Unix /bin/sh interpreter:
# Check for modification of tags.
# Reject tag modifications except creation and deletion
echo "=============== changed ================" >>/tmp/pre-commit.log
$SVNLOOK changed -t "$TXN" "$REPOS" >>/tmp/pre-commit.log
$SVNLOOK changed -t "$TXN" "$REPOS" | grep "tags/" >/dev/null
if [ $? -eq 0 ] ; then
$SVNLOOK changed -t "$TXN" "$REPOS" | egrep "^[AD][[:space:]]+(.*/)?tags/[^/]+/$" >/dev/null
if [ $? -ne 0 ] ; then
echo >&2 "Modification of tags is not allowed"
# Make sure that the log message contains some text.
$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null
if [ $? -ne 0 ] ; then
echo >&2 "You must give a meaningful comment for commits"
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Wed Sep 15 08:58:52 2004