[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

pre-commit hook script help

From: Phil <plabonte_at_gmail.com>
Date: 2006-11-10 02:01:47 CET

I need a hook script that will either check to make sure svn:needs-lock is
set for all files or a hook script that will set svn:needs-lock for all
I have the following hook script that works but only for files WITHOUT
spaces in the file name...

Could someone help me by suggestiong how I can improve the following script
or perhaps they have written one that works that I could modify.

Here is my pre-commit script:


# Arguments passed to the script.

# 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
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

    # 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."
        echo "Repository policy dictates that all files must set the
svn:needs-lock property." 1>&2
        exit 1


# If we haven't exited by now, everything must be fine.
exit 0
Received on Fri Nov 10 02:02:20 2006

This is an archived mail posted to the Subversion Users mailing list.