You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by vinay i <vi...@gmail.com> on 2008/11/11 18:02:41 UTC

Is it possible to set svn:keywords using pre-commit hook script?

Hello All,

I would like to set svn:keywords on all known non-binary files (if it is not
already set) during a commit. Is this feasible? Because pre-commit hook
script takes two arguments as inputs ( repository and transaction) and
doesn't have information regarding the files being committed. How to
identify the list of files on which the svn:keywords property has to be set?

Thanks
Vinay

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by David Weintraub <qa...@gmail.com>.
The best thing to do is provide an auto-properties "config" file for
your users to use -- complete with instructions on how and where to
install it.

Then create a pre-commit hook script that rejects any commits that
fail to set this property up properly. As part of the reject, give the
location of the read-me that has the information about
auto-properties. For example, if you have a company wide Wiki, put the
directions and a copy of the auto-properties file there.

It doesn't take more than two or three failed commits before even the
most stubborn developer falls into line and installs the right
autoproperties in their configuration.

I have a Perl script that checks for read/write/add permissions,
checks for invalid file names, and also verifies that properties are
set to their correct values. It's what I use to enforce this type of
situation.

--
David Weintraub
qazwart@gmail.com



On Tue, Nov 11, 2008 at 1:02 PM, vinay i <vi...@gmail.com> wrote:
> Hello All,
>
> I would like to set svn:keywords on all known non-binary files (if it is not
> already set) during a commit. Is this feasible? Because pre-commit hook
> script takes two arguments as inputs ( repository and transaction) and
> doesn't have information regarding the files being committed. How to
> identify the list of files on which the svn:keywords property has to be set?
>
> Thanks
> Vinay
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by Andy Levy <an...@gmail.com>.
On Tue, Nov 11, 2008 at 14:07, vinay i <vi...@gmail.com> wrote:
> But isn't there a way I can set the svn:keywords by running a script
> whenever I do a add or probably before a commit. Controlling this from a
> client side is painful.

Yes, you can set them client-side, via auto-props. Modifying an
in-flight transaction is even more painful than a hook script which
rejects the commit if your rules aren't followed.

> Hence, I would like to write script which will run
> svn propset svn:keywords <filenames>. But I am not sure whether it is
> feasible.

There is an svn_apply_autoprops Python script. It reads your client's
auto-props section of the config file, and applies any properties per
the rules set there. However, if you have set non-conforming
properties on files that match the auto-props, they will also be
removed.

> Please let me know your thoughts
>
> Thanks
> Vinay
>
> On Tue, Nov 11, 2008 at 11:45 PM, Andy Levy <an...@gmail.com> wrote:
>>
>> On Tue, Nov 11, 2008 at 13:02, vinay i <vi...@gmail.com> wrote:
>> > Hello All,
>> >
>> > I would like to set svn:keywords on all known non-binary files (if it is
>> > not
>> > already set) during a commit. Is this feasible? Because pre-commit hook
>> > script takes two arguments as inputs ( repository and transaction) and
>> > doesn't have information regarding the files being committed. How to
>> > identify the list of files on which the svn:keywords property has to be
>> > set?
>>
>> Modifying transactions in-flight should not be done, for many reasons
>> which have been discussed many times on this mailing list. If a commit
>> doesn't conform to your rules, reject the commit & send a message back
>> to the client indicating why it was rejected.
>>
>> You need to use svnlook changed and svnlook diff to inspect what changed.
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by Andy Levy <an...@gmail.com>.
On Tue, Nov 18, 2008 at 11:42, vinay i <vi...@gmail.com> wrote:
> But there isn't any /etc/subversion directory in my UNIX system. So, I am
> not sure the way the config file is getting created now.

What if you create one, and put a config file in it (make sure it
differs from the settings you found so that you can tell if it's being
copied)?

Please see the manual.
http://svnbook.red-bean.com/en/1.5/svn.advanced.confarea.html#svn.advanced.confarea.layout
second paragraph.

> On Tue, Nov 18, 2008 at 9:44 PM, Andy Levy <an...@gmail.com> wrote:
>>
>> On Tue, Nov 18, 2008 at 11:12, vinay i <vi...@gmail.com> wrote:
>> > Hello All,
>> >
>> > .subversion/config file is created the 1st time we run a svn command. I
>> > believe the default values what it takes is controlled by
>> > "http://svn.collab.net/repos/svn/trunk/subversion/include/svn_config.h"
>> > file. Correct me if I am worng. Can we modify this file or whichever is
>> > appropriate so that whenever a user runs the svn command for the 1st
>> > time a
>> > default customized config file is created. Say which has the svn:mime,
>> > svn
>> > editor, svn:keyowrds and other useful properties set to some default
>> > other
>> > than provided by subversion? Has anyone tried this method?
>>
>> I think on *NIX systems, if you have a default config file in
>> /etc/subversion that will be copied when svn is first run by a user.
>>
>> > On Wed, Nov 12, 2008 at 12:50 AM, Bill Hoffman
>> > <bi...@kitware.com>
>> > wrote:
>> >>
>> >> vinay i wrote:
>> >>>
>> >>> But isn't there a way I can set the svn:keywords by running a script
>> >>> whenever I do a add or probably before a commit. Controlling this from
>> >>> a
>> >>> client side is painful. Hence, I would like to write script which will
>> >>> run
>> >>> svn propset svn:keywords <filenames>. But I am not sure whether it is
>> >>> feasible.
>> >>>
>> >> See the thread I started about three weeks ago on this list titled:
>> >>
>> >> "svn config file and mime types"
>> >>
>> >> http://svn.haxx.se/users/archive-2008-10/0707.shtml
>> >>
>> >>
>> >> IMO, this is a major short falling of svn.  It is also a long standing
>> >> feature request:
>> >>
>> >> http://subversion.tigris.org/issues/show_bug.cgi?id=1974
>> >>
>> >> Having each client specify this stuff is really hard to enforce and
>> >> very
>> >> error prone.   It really should be part of the repository and stored in
>> >> the
>> >> .svn directories for a project.   I realize there are some technical
>> >> hurdles
>> >> to the implementation, but the current situation is a real pain...
>> >>
>> >> -Bill
>> >
>> >
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by vinay i <vi...@gmail.com>.
But there isn't any /etc/subversion directory in my UNIX system. So, I am
not sure the way the config file is getting created now.

Thanks
Vinay

On Tue, Nov 18, 2008 at 9:44 PM, Andy Levy <an...@gmail.com> wrote:

> On Tue, Nov 18, 2008 at 11:12, vinay i <vi...@gmail.com> wrote:
> > Hello All,
> >
> > .subversion/config file is created the 1st time we run a svn command. I
> > believe the default values what it takes is controlled by
> > "http://svn.collab.net/repos/svn/trunk/subversion/include/svn_config.h"
> > file. Correct me if I am worng. Can we modify this file or whichever is
> > appropriate so that whenever a user runs the svn command for the 1st time
> a
> > default customized config file is created. Say which has the svn:mime,
> svn
> > editor, svn:keyowrds and other useful properties set to some default
> other
> > than provided by subversion? Has anyone tried this method?
>
> I think on *NIX systems, if you have a default config file in
> /etc/subversion that will be copied when svn is first run by a user.
>
> > On Wed, Nov 12, 2008 at 12:50 AM, Bill Hoffman <bill.hoffman@kitware.com
> >
> > wrote:
> >>
> >> vinay i wrote:
> >>>
> >>> But isn't there a way I can set the svn:keywords by running a script
> >>> whenever I do a add or probably before a commit. Controlling this from
> a
> >>> client side is painful. Hence, I would like to write script which will
> run
> >>> svn propset svn:keywords <filenames>. But I am not sure whether it is
> >>> feasible.
> >>>
> >> See the thread I started about three weeks ago on this list titled:
> >>
> >> "svn config file and mime types"
> >>
> >> http://svn.haxx.se/users/archive-2008-10/0707.shtml
> >>
> >>
> >> IMO, this is a major short falling of svn.  It is also a long standing
> >> feature request:
> >>
> >> http://subversion.tigris.org/issues/show_bug.cgi?id=1974
> >>
> >> Having each client specify this stuff is really hard to enforce and very
> >> error prone.   It really should be part of the repository and stored in
> the
> >> .svn directories for a project.   I realize there are some technical
> hurdles
> >> to the implementation, but the current situation is a real pain...
> >>
> >> -Bill
> >
> >
>

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by Andy Levy <an...@gmail.com>.
On Tue, Nov 18, 2008 at 11:12, vinay i <vi...@gmail.com> wrote:
> Hello All,
>
> .subversion/config file is created the 1st time we run a svn command. I
> believe the default values what it takes is controlled by
> "http://svn.collab.net/repos/svn/trunk/subversion/include/svn_config.h"
> file. Correct me if I am worng. Can we modify this file or whichever is
> appropriate so that whenever a user runs the svn command for the 1st time a
> default customized config file is created. Say which has the svn:mime, svn
> editor, svn:keyowrds and other useful properties set to some default other
> than provided by subversion? Has anyone tried this method?

I think on *NIX systems, if you have a default config file in
/etc/subversion that will be copied when svn is first run by a user.

> On Wed, Nov 12, 2008 at 12:50 AM, Bill Hoffman <bi...@kitware.com>
> wrote:
>>
>> vinay i wrote:
>>>
>>> But isn't there a way I can set the svn:keywords by running a script
>>> whenever I do a add or probably before a commit. Controlling this from a
>>> client side is painful. Hence, I would like to write script which will run
>>> svn propset svn:keywords <filenames>. But I am not sure whether it is
>>> feasible.
>>>
>> See the thread I started about three weeks ago on this list titled:
>>
>> "svn config file and mime types"
>>
>> http://svn.haxx.se/users/archive-2008-10/0707.shtml
>>
>>
>> IMO, this is a major short falling of svn.  It is also a long standing
>> feature request:
>>
>> http://subversion.tigris.org/issues/show_bug.cgi?id=1974
>>
>> Having each client specify this stuff is really hard to enforce and very
>> error prone.   It really should be part of the repository and stored in the
>> .svn directories for a project.   I realize there are some technical hurdles
>> to the implementation, but the current situation is a real pain...
>>
>> -Bill
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by vinay i <vi...@gmail.com>.
Hello All,

.subversion/config file is created the 1st time we run a svn command. I
believe the default values what it takes is controlled by "
http://svn.collab.net/repos/svn/trunk/subversion/include/svn_config.h" file.
Correct me if I am worng. Can we modify this file or whichever is
appropriate so that whenever a user runs the svn command for the 1st time a
default customized config file is created. Say which has the svn:mime, svn
editor, svn:keyowrds and other useful properties set to some default other
than provided by subversion? Has anyone tried this method?

Thanks
Vinay

On Wed, Nov 12, 2008 at 12:50 AM, Bill Hoffman <bi...@kitware.com>wrote:

> vinay i wrote:
>
>> But isn't there a way I can set the svn:keywords by running a script
>> whenever I do a add or probably before a commit. Controlling this from a
>> client side is painful. Hence, I would like to write script which will run
>> svn propset svn:keywords <filenames>. But I am not sure whether it is
>> feasible.
>>
>>  See the thread I started about three weeks ago on this list titled:
>
> "svn config file and mime types"
>
> http://svn.haxx.se/users/archive-2008-10/0707.shtml
>
>
> IMO, this is a major short falling of svn.  It is also a long standing
> feature request:
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=1974
>
> Having each client specify this stuff is really hard to enforce and very
> error prone.   It really should be part of the repository and stored in the
> .svn directories for a project.   I realize there are some technical hurdles
> to the implementation, but the current situation is a real pain...
>
> -Bill
>

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by Bill Hoffman <bi...@kitware.com>.
vinay i wrote:
> But isn't there a way I can set the svn:keywords by running a script 
> whenever I do a add or probably before a commit. Controlling this from a 
> client side is painful. Hence, I would like to write script which will 
> run svn propset svn:keywords <filenames>. But I am not sure whether it 
> is feasible.
> 
See the thread I started about three weeks ago on this list titled:

"svn config file and mime types"

http://svn.haxx.se/users/archive-2008-10/0707.shtml


IMO, this is a major short falling of svn.  It is also a long standing 
feature request:

http://subversion.tigris.org/issues/show_bug.cgi?id=1974

Having each client specify this stuff is really hard to enforce and very 
error prone.   It really should be part of the repository and stored in 
the .svn directories for a project.   I realize there are some technical 
hurdles to the implementation, but the current situation is a real pain...

-Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by vinay i <vi...@gmail.com>.
But isn't there a way I can set the svn:keywords by running a script
whenever I do a add or probably before a commit. Controlling this from a
client side is painful. Hence, I would like to write script which will run
svn propset svn:keywords <filenames>. But I am not sure whether it is
feasible.

Please let me know your thoughts

Thanks
Vinay

On Tue, Nov 11, 2008 at 11:45 PM, Andy Levy <an...@gmail.com> wrote:

> On Tue, Nov 11, 2008 at 13:02, vinay i <vi...@gmail.com> wrote:
> > Hello All,
> >
> > I would like to set svn:keywords on all known non-binary files (if it is
> not
> > already set) during a commit. Is this feasible? Because pre-commit hook
> > script takes two arguments as inputs ( repository and transaction) and
> > doesn't have information regarding the files being committed. How to
> > identify the list of files on which the svn:keywords property has to be
> set?
>
> Modifying transactions in-flight should not be done, for many reasons
> which have been discussed many times on this mailing list. If a commit
> doesn't conform to your rules, reject the commit & send a message back
> to the client indicating why it was rejected.
>
> You need to use svnlook changed and svnlook diff to inspect what changed.
>

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by David Ferguson <fe...@gmail.com>.
Vinay,

You can do this on the client-side by modifying the auto-props section of
your ~/.subversion/config file.

Unfortunately Subversion doesn't support server-side auto-props setting just
yet.



On Tue, Nov 11, 2008 at 1:15 PM, Andy Levy <an...@gmail.com> wrote:

> On Tue, Nov 11, 2008 at 13:02, vinay i <vi...@gmail.com> wrote:
> > Hello All,
> >
> > I would like to set svn:keywords on all known non-binary files (if it is
> not
> > already set) during a commit. Is this feasible? Because pre-commit hook
> > script takes two arguments as inputs ( repository and transaction) and
> > doesn't have information regarding the files being committed. How to
> > identify the list of files on which the svn:keywords property has to be
> set?
>
> Modifying transactions in-flight should not be done, for many reasons
> which have been discussed many times on this mailing list. If a commit
> doesn't conform to your rules, reject the commit & send a message back
> to the client indicating why it was rejected.
>
> You need to use svnlook changed and svnlook diff to inspect what changed.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

Re: Is it possible to set svn:keywords using pre-commit hook script?

Posted by Andy Levy <an...@gmail.com>.
On Tue, Nov 11, 2008 at 13:02, vinay i <vi...@gmail.com> wrote:
> Hello All,
>
> I would like to set svn:keywords on all known non-binary files (if it is not
> already set) during a commit. Is this feasible? Because pre-commit hook
> script takes two arguments as inputs ( repository and transaction) and
> doesn't have information regarding the files being committed. How to
> identify the list of files on which the svn:keywords property has to be set?

Modifying transactions in-flight should not be done, for many reasons
which have been discussed many times on this mailing list. If a commit
doesn't conform to your rules, reject the commit & send a message back
to the client indicating why it was rejected.

You need to use svnlook changed and svnlook diff to inspect what changed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org