You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Subversion Repository Hook : commit-email

Description:

This Post-Commit hook can be used to send a notification email describing either a commit or a revprop-change action on a Subversion repository.

Installation:

These instructions assume that you are using the subversion command line interface on a Unix system. Your process may be slightly different depending on client and operating system.

  • Check out your /rice-config repository folder
svn co https://svn.rice.edu/r/REPONAME/rice_config
  • Change to the rice_config folder
cd rice_config/
  • Create a folder called hooks
mkdir hooks/
  • Change into the hooks folder
cd hooks/
  • Create a file called commit-email See the Configuration section below
vi commit-email
  • Add the directory and file to the repository
cd ../../
svn add hooks
svn commit -m "Added commit-email hook to the repository"

Configuration

The commit-email hook requires some configuration. Within the commit-email file you need to put arguments that tell the script what you want to notify on and who to notify. It will look similar to this:

no_diff_deleted=0
no_diff_added=0

notify.0.email_addresses = user1@rice.edu
notify.0.from_address= fromuser1@rice.edu
notify.0.reply_to = user1@pobox.com
notify.0.subject_prefix = Any PROJECT COMMIT:
notify.0.show_diff = 1

notify.1.email_addresses= user1@rice.edu, user2@rice.edu,user3@pobox.com
notify.1.from_address= user4@pobox.com
notify.1.match_regex= project1/
notify.1.reply_to = user4@pobox.com
notify.1.subject_prefix = PROJECT1 COMMIT:
notify.1.show_diff = 0

Argument Descriptions

  • no_diff_deleted -

    By default, when a file is deleted from the repository, svnlook diff
    prints the entire contents of the file. If you want to save space
    in the log and email messages by not printing the file, then set
    no_diff_deleted to 1.

  • no_diff_added -

    By default, when a file is added to the repository, svnlook diff
    prints the entire contents of the file. If you want to save space
    in the log and email messages by not printing the file, then set
    no_diff_added to 1.

Tagged Arguments

Tagged Arguments require the word notify. and some unique value also followed by a dot to prepend the argument. This is used to group all of the arguments together.

  • email_addresses -

    This can be a single email address or multiple email addresses separated with commas. These are the addresses that the email message will be sent to.

  • from_address -

    This is a single email address. It will be the From: address specified in the email.

  • match_regex -

    This is a regular expression used to match locations within the repository. When changes occur within these locations, emails will be sent. Do not use a leading /. If you want to anchor the pattern to the top of the repository use the ^. If you leave this argument out, it will default to matching the entire repository.

  • reply_to -

    This is a single email address. It will be the Reply-To: address specified in the email.

  • subject_prefix -

    This is a short string. It will be prepended to the subject line.

  • show_diff -

    This is a 1 or a 0. It indicates whether to display the diffs of changed files.

  • No labels