On Thu, Dec 16, 2010 at 10:44:05AM -0600, Mark Meyer wrote:
> Hello all,
>
>
>
> I am currently using svn commit hooks in our environment to trap ALL
> commits. The commit hook sends an email to my address.
>
>
>
> A typical email generated by a commit looks like this:
>
>
>
> >>
>
> Author: mmeyer
>
>
>
> Comments: added comments
>
>
>
>
>
> 3935
>
> U Java Projects/sandbox/mark/schema/auf/xml/testdbupgrade.xml
>
> <<
>
>
>
>
>
> How do you write a commit hook that traps on changes to a SPECIFIC file
> (our database create script) so I can capture all of these changes
> separately. This would allow me to do a better job of maintaining our
> alter scripts that migrate our database from one version to the next.
>
>
>
> Example:
>
>
>
> I would like to hook on any changes made when this file is changed:
>
>
>
> <<
>
> Comments: added ip_address to conditions and added received_timestamp
> to test results
>
>
>
>
>
> 3922
>
> U Database/trunk/MP/mysql/create/primexmp-create.sql
>
> <<
>
>
>
> Thank you,
>
> Mark
In the post-commit hook, you could get the list of files modified in the
committed revision and send email if the file appears in this list.
In pseudocode:
REPOS_PATH="$1" # First parameter passed to post-commit hook by Subversion
REV="$2" # Second parameter passed to post-commit hook by Subversion
MYFILE=Database/trunk/MP/mysql/create/primexmp-create.sql
if output of "svnlook changed -r $REV $REPOS_PATH" contains $MYFILE:
send email
endif
Stefan
Received on 2010-12-16 19:11:33 CET