You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Eric Thomas <er...@psteering.com> on 2005/03/07 20:36:37 UTC

Altering source file contents with hooks

 
Hi all,
 
I'm curious - is there a way, using any of the Subversion pre-/post-/start-commit hooks, to alter the actual contents of a source file before it's committed?  For example, we might want to add a commented copyright notice to every source file, or run every file through a "pretty-printer" program to standardize formatting.
 
I looked through the docs and didn't find anything - it doesn't seem like any hooks allow direct access to the file.  Am I missing something?
 
Thanks in advance...
 
Eric Thomas
Release Manager
PowerSteering Software, Inc.
 

Re: Altering source file contents with hooks

Posted by Steve Greenland <st...@lsli.com>.
On Mon, Mar 07, 2005 at 03:36:37PM -0500, Eric Thomas wrote:
> I looked through the docs and didn't find anything - it doesn't
> seem like any hooks allow direct access to the file. Am I missing
> something?

You missed the big warning in the manual that says not to do that. :-)

Basically, the problem is that if you modify the data at the server,
then what the client sent is not what is committed. This is misleading,
confusing, and generally a Bad Thing(tm).

What you can do is examine the file and reject the commit if it does not
meet local standards.

Steve

-- 
"Outlook not so good." That magic 8-ball knows everything! I'll ask
about Exchange Server next.
                           -- (Stolen from the net)

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