views:

222

answers:

2

Tricky question: I need the following to happen:

1) Before you click commit, tortoisesvn should insert a legal notice comment to the code files being commited. I am talking about client side event ONLY.

2) Svn:keywords are not going to work because those keywords need to be in the file already.

May be there is a way to write plugin for tortoise?

+2  A: 

Should this really be a client side action? If its really important, why not a pre-commit hook on the server to verify the disclaimer and update the code if its not present?

John Ellinwood
It is not allowed to modify contents inside a hook script on commit: see "do not modify a commit transaction using hook scripts" [ warning on http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks ]
jdehaan
I am only talking about client side action. So when I said commit, I meant when you click commit button on tortoise, before that I want to modify the file on the client side.
Chicago
+2  A: 

CLIENT SIDE HOOK SCRIPTS (SAFE but svn client specific):

The only safe way to do it is to use client side hook scripts. Here a hint on how to perform this with TortoiseSVN: http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-settings.html

DO NOT USE SERVER HOOK SCRIPTS:

Server side hook scripts won't help, it is not allowed to modify data there (thought not enforced). The reason is that the server side script cannot modify your local copy and you end up in mismatching data. See http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks for more details regarding this.

jdehaan
I did not know about client-side hooks. Almost positive that this is what I need. Will try it and let you guys know. Thanks!
Chicago
I forgot to say but it's quite clear that you would have to install the hook scripts on all clients... (With a server hook check to enforce a given formatting -> that creates the synergy effect that lets the users install the scripts themselves)
jdehaan
yeah, that is exactly what i was planning to do. Also, there is a way to just change the registry(that's where client hooks set-up is stored). That change can be done with a script.
Chicago
Good luck with the deployment!
jdehaan