Greg Thomas wrote:
> On Thu, 15 Sep 2005 16:35:28 +0200, "Felix Gilcher"
> <gilcher@exozet.com> wrote:
>
>   
>> There are several threads here on this list explaining why you should never manipulate code in a pre-commit-hook script.
>>     
>
> However, you could do it in a post-commit hook. This would have to
> checkout a wc on the server, run the tidy script over the code, and
> then commit the changes, before cleaning up after itself.
>
> Greg
>   
But then you would have to be careful of who the author is of that code 
as you are now essentially looking at two separate commits.  First by 
the developer, and the second by whatever user you are going to run your 
script under.  Which then leads me to wonder if you aren't creating a 
cyclic redundancy.  How does your post-commit hook know not to run when 
your automated process has run and cleaned up code and then committed again?
I have seen this sort of process mentioned on the board before, and the 
guru's pretty much all recommend not doing this from the server side.  I 
think I agree with them.  Data clean-up really shouldn't be part of the 
Subversion process.
If you are using the svn command line, create a separate shell script 
that will first run your tidy program and then do the commit.  Then it 
all happens on the client side.  If you are using something like 
TortoiseSVN, you may have to either munge some of their code, or make a 
request of the TortoiseSVN group to create a parameter asking for an 
action / batch file to call .  Who knows - maybe they will create a 
little rules engine that allows you to run a command pre- or post- 
commit, update, checkout, etc. to allow for other activities to occur 
client side.
Regards,
Frank
Received on Thu Sep 15 17:43:06 2005