On 7/16/07, Arnauld Van Muysewinkel <arnauldvm@gmail.com> wrote:
> 2007/7/12, Ryan Schmidt <subversion-2007b@ryandesign.com>:
> > On Jul 12, 2007, at 04:32, Dong Jiwei wrote:
> > > I want to write a hook that can modify the file to be committed, for
> > > example, it the file is a shell script, then I want to add one line
> > > "echo
> > > $END_DATE" at the file end.
> > > How can I got the file and modify it in hooks?
> >
> > Don't do that. Instead, you can write a pre-commit hook which rejects
> > the commit of any file that doesn't end with that line. Then instruct
> > your developers to add that line themselves before committing.
> >
> > > And one more question is will this operation cause the inconsistence
> > > between the WC and REOPS?
> >
> > That's exactly why you mustn't modify a transaction: the working copy
> > will think it has a file at, say, revision 42, but the repository
> > will think revision 42 looks different. When you later try to update,
> > things will blow up.
> >
> > > I think the Subversion svn:keywords auto substitution may work of
> > > the same mechanism? Any one tell me how to do this?
> >
> > Keyword substitution works differently. It works on the client side
> > only. The keywords are only expanded to their actual values upon
> > checkout or export; they're not stored that way in the repository.
>
> Is there anything like "client-side hooks" ? Hooks that would check
> and/or modify the WC files *before* committing them ?
Only if you add wrapper programs to your svn executable, but not
something which automatically comes with a repository configuration.
It would be an extreme security risk to introduce them built into
Subversion (what I mean by that is that it's very hard to do
correctly).
The standard procedure here is to reject commits which are improperly
formatted or missing vital parts.
bye,
Erik.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Jul 16 09:22:45 2007