Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest/best way to set up SVN commit emails?

Tags:

svn

svn-hooks

I'd like to set up commit emails on a project I'm work on, as described here:
http://producingoss.com/en/vc.html#commit-emails

That is, use a post commit hook to send an email to a list containing the commit title/log and diff of the changes.

What's the easiest way on a Linux machine to set this up?

like image 529
Will Robertson Avatar asked Feb 01 '09 22:02

Will Robertson


People also ask

How to commit code to Tortoise svn?

Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files. If you don't want a changed file to be committed, just uncheck that file.

What does svn commit mean?

svn commit will send any lock tokens that it finds and will release locks on all PATH s committed (recursively) unless --no-unlock is passed. Tip. If you begin a commit and Subversion launches your editor to compose the commit message, you can still abort without committing your changes.


2 Answers

Although this question is a bit old, just thought I would leave my opinion for those coming here from Google:

I've considered the solutions mentioned here. The commit-email.pl was both easier and better working for me. However, I find both solutions lacking proper formatting.

Thus, the svnnotify package seems to produce well-enough formatted and colored emails for me.

On Debian/Ubuntu systems you can install it by typing:

apt-get install libsvn-notify-perl

Then, if you are gonna send emails to Gmail accounts, due to odd CSS support in Gmail, I would strongly recommend applying the patch found here, which means:

  • Download HTML.pm and ColorDiff.pm
  • Replace with them /usr/share/perl5/SVN/Notify/HTML.pm and /usr/share/perl5/SVN/Notify/HTML/ColorDiff.pm, respectively.

And finally, setup the post-commit hook script the usual way:

# email notifications for commits
/usr/bin/svnnotify --repos-path "$REPOS" --revision "$REV" \
    --to [email protected] \
    --from [email protected] \
    --with-diff \
    --subject-cx \
    --subject-prefix 'Your Project Name: ' \
    --handler HTML::ColorDiff \
    --css-inline
    2>&1 &

exit 0
like image 170
Dimitar Avatar answered Sep 30 '22 10:09

Dimitar


When creating new repository a sample post-commit hook is provided in hooks/post-commit.tmpl. It contains a line that looks more or less like this:

/usr/share/subversion/hook-scripts/commit-email.pl "$REPOS" "$REV" [email protected]

Just substitute the email with the address you want to send notifications to, rename the script to hooks/post-commit (remove the tmpl extension) and make it executable (chmod a+x).

When you run the commit-email.pl script without any arguments you will see an usage screen with extra options that allow for example to modify the subject line or the From address.

Please note that is case of Debian the commit-email.pl script is located in an optional subversion-tools package.

like image 35
Adam Byrtek Avatar answered Sep 30 '22 08:09

Adam Byrtek