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

Re: Setting eol-style property on post commit hook

From: Ryan Schmidt <subversion-2008a_at_ryandesign.com>
Date: Mon, 24 Mar 2008 18:58:51 -0500

On Mar 24, 2008, at 18:33, mfs wrote:

> So basically i want to set an eol-style property to native for all
> my text
> based files. I will be enforcing this by making the developers/
> committers
> enable the property "enable-auto-props" and accordingly set the file
> extensions on which the property is applied in their subversion/
> config file.
> BUT at the same time for users who mistakenly (or carelessly) dont
> set the
> property, i would want to have a script executed on post-commit
> hook on the
> subversion server.
> Now i have following questions/concern
> 1) Is it a good idea to set the property using a script invoked on a
> post-commit hook ? What implications can it have. In certain
> threads people
> have suggested to rather have a strategy where the commits are
> rejected if
> the property is not already set. Why is such an approach suggested
> over the
> first one ?

I would recommend instead that you reject unsatisfactory commits and
make the developer do it right in the first place. After a few
mistakes, they'll learn to do it right.

The problems with doing it in a post-commit hook are that you need to
keep track of a working copy on the server, and you create an
additional revision just for the property changes, and the user's
working copy is thus immediately out of date and they have to
immediately do an "svn update" after each "svn commit" where they
have forgotten properties. And if you can't get them to remember to
set properties, why would they remember to do an update?

> 2) Now, If it is ok to have such script, would the script require
> doing an
> svn update and (after svn propset to eol-style) a commit again ?,

Yes, that's correct.

> cant we
> just update the property on the actual files without the need to
> synchronizing them and doing another commit

No, that's not possible. You cannot modify the transaction in progress.

> (since that i believe would
> introduce another revision just for setting the property),

Yes, it would create a new revision just for the property setting.

> given the hook be
> running on the same machine..

The hook is running on the server. The user's working copy is on the
client. The hook script would have to have its own working copy on
the server for this purpose.

To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-03-25 00:59:42 CET

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.