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

Re: pre-commit hook script help

From: Phil <plabonte_at_gmail.com>
Date: 2006-11-10 19:37:27 CET

can you give me some help on how to interpret these files? I am not a
programmer so I am pretty usueless when it comes to figuring out what this
perl script is doing....

On 11/10/06, Jon Week <jonawr@hotmail.com> wrote:
>
> David Weintraub made a very nice perl script
> (pre-commit-access-control-hook.pl) that expands upon the
> commit-access-control.pl script. I'm not sure why this never replaced the
> commit-access-control.pl. Anyhow, this script will control access, along
> with the ability to check for the svn:needs-lock property, ban filenames
> with spaces, ban illegal characters, ban certain file types from the
> repository, etc.. Hopefully this will solve your problem, but I haven't
> tested your situation.
>
> The two files are attached and are fairly self explanatory.
>
> -Jon
>
> >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
> >files.
> >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:
> >#!/bin/bash
> >
> >SVNLOOK=/usr/local/bin/svnlook
> >SED=/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
>
> _________________________________________________________________
> Add a Yahoo! contact to Windows Live Messenger for a chance to win a free
> trip!
>
> http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-us&hmtagline
>
>
>
Received on Fri Nov 10 19:38:24 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.