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

Re: svnperms svnlook problem

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-10-25 00:45:38 CEST

On Oct 24, 2007, at 14:16, Bicking, David (HHoldings, IT) wrote:

>>> REPOS="$1"
>>> TXN="$2"
>>> ## Make sure that the log message contains some text.
>>> SVNLOOK=/usr/bin/svnlook
>>> $SVNLOOK log -t $TXN $REPOS | \
>>> grep "[a-zA-Z0-9]" > /dev/null || exit 1
>>>
>>> 1. Why is the svnlook needed?
>>> 2. Why doesn't this work (why is it exiting here)?
>>> 3. Do I need svnlook with this pre-commit hook?

>>> svnperms.py that follows. I've run svnlook on a command line and I
>>> get the message "svnlook: No such transaction". Maybe
>> that's because
>>> when I run it the transaction number is not valid. If I
>> put debugging
>>> statements in the script to see the output of svnlook, it
>> is blank -
>>> even if I take out the grep. svnlook is executable by
>> anyone. If I
>>> comment this out, the svnperms.py is executed and performs
>> its function as desired.
>>
>> The svnlook code is there as an example. Just calling out to
>> svnperms.py is fine if you don't desire the log message to be
>> a non-empty string.
>
> About the original question #2 about what happens here:
> I'm not a bash pro, but it appears your error is due to two things.
> First, the SVNLOOK command parameters are reversed, thus causing the
> error.

The order of the parameters is immaterial. svnlook, like svn, accepts
parameters in pretty much any order. Try it out.

> Second, There is an "or" statement in play, so if you get a
> non-zero exit code (failure), the second test occurs (exit 1) which
> will
> cause your exit at that line. The "grep" was never the issue.

The example code from the tmpl file gets the log message of the
transaction using svnlook, and pipes it thru grep to check that it
contains at least one letter or number. If it does not, it exits. The
example could be improved to output an error message in this case,
but as written it does not do that.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Oct 25 00:48:22 2007

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.