[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: Ryan Schmidt <subversion-2006d_at_ryandesign.com>
Date: 2006-11-11 00:58:44 CET

On Nov 10, 2006, at 17:38, Phil wrote:

>> > All I really need is something to set svn:needs-lock on all
>> > commited files...
>> > perhaps someone can point me in the right direction?
>> >
>> > I am no programmer unfortunately... I am not too interested in
>> > checking to see if the file has it set or not... I would rather
>> > just set it to svn:needs-lock for everything...
>> >
>> > is this possible at the server end? I know I can do this with auto-
>> > props at the client side... but that is too risky...
>>
>> No, that's really not how it's done in Subversion. There is no way to
>> force all files to be that way on the server side. The Subversion way
>> to do it is:
>>
>> - Set up the clients to set the property on the desired files, e.g.
>> with auto-props
>> - Install a pre-commit hook to reject commits of files that do not
>> have tho property
>
> the problem is that I am not a programmer and I have never seen a
> script posted that can actually do the checking... I tried to find
> one on google or a "how to program a hook script" one myself (with
> my limited knowledge) without success...

Well, it does require some programming knowledge to modify hook scripts.

I thought there was a pre-commit hook already written that would take
as its input a Subversion config file and read out the auto-props
definitions you had made, and enforce them on the incoming commit.
But I don't know how to find that now. I've tried a few searches.

Here's a script which is part of the Subversion source distribution
which could be a fairly simple example of checking for properties.

http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/check-mime-
type.pl

This one checks that svn:mime-type is set and, if the MIME type
starts with "text/", makes sure svn:eol-style is set. You could
modify the few lines there to have it make sure instead that
svn:needs-lock is set.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Nov 11 00:59:27 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.