SVN post commit hook to send email to user when changing a specific file

I would like to add a link to the message fixation, so that if the user makes changes to a specific file, I will be notified by email.

Has anyone seen an example of this, or is this possible?

I set pre commit hook before, but this is the limit of my knowledge.

+5
source share
3 answers

I have a post commit on github that does just that and allows users (and not the administrator to tell which files they are following changes and which email addresses these changes should be sent.

pre-commit-kitchen-sink hook, . hook Perl, , .

, :

mail = david@gmail.com
file =**/build.xml
match = [Mm]akefile

mail . . file - glob ( ) , . match , Perl, .

Subversion . , . pre-commit- , :

[file You are only allowed to change their own watch files]
file =/watchfiles/**
permission = read-only
users = @ALL

[file You are only allowed to change their own watch files]
file = /watchfiles/<USER>.cfg
permission = read-write
users = @ALL

<USER> .


, ? file = ab/build.xml, bb/cs.txt, cc/. ..

:

 email = my@email.com
 file = **/ab/build.xml
 file = **/bb/cs.txt
 file = **/cc/*.*

, file glob ( / ), **/ .

+6
+1

i configure the PHP script to execute using post-commit. You can edit the PHP script to be pretty smart, and depending on which files were reset, follow certain steps.

/ blasting / Hooks / after fixing:

 REPOS="$1"
 REV="$2"
 MESSAGE=$(svnlook propget --revprop -r $REV $REPOS svn:log)
 CHANGES=$(svnlook changed -r $REV $REPOS)
 php /usr/share/subversion/hook-scripts/commit-email.php "$REPOS" "$REV" "$MESSAGE" "$CHANGES"

/usr/share/subversion/hook-scripts/commit-email.php:

 <?php
      //files updated will be in $_SERVER['argv'][4], you could expand it in to an a
      //array and search for what you need, and depending on what found, send emails accordingly.
 ?>
0
source

All Articles