Definitive guide to svn post-commit emails with nice colored diffs on DreamHost
Posted by Kelvin on 08 Jun 2010 at 02:59 am | Tagged as: programming
Step 1
mkdir ~/perl
Step 2
perl -MCPAN -e 'install SVN::Notify'
This command will try to do something, then most probably fail. That's OK.
Step 3
Change ~/.cpan/CPAN/MyConfig.pm to contain:
'makepl_arg' => q[PREFIX=/home/username/perl LIB=/home/username/perl/lib],
'mbuildpl_arg' => q[install_base=/home/username/perl],
Step 4
perl -MCPAN -e 'install SVN::Notify'
This should now install properly
Step 5
Running
~/perl/bin/svnnotify
should produce:
Missing required "--repos-path" parameter
Step 6
cd ~/svn/REPO/hooks vim post-commit
Paste this
#!/bin/sh REPOS="$1" REV="$2" PATH=/usr/bin:/bin:~/perl/bin PROJECT=CHANGEME export PERL5LIB="$HOME/perl/lib/perl5:$PERL5LIB" svnnotify --repos-path "$REPOS" \ --revision "$REV" \ --svnlook /usr/bin/svnlook \ --to CHANGEME \ --from $COMMITTER@$PROJECT.com \ --with-diff --subject-cx --handler HTML::ColorDiff \ --max-diff-length 15000 --subject-prefix commit-
The last line
--max-diff-length 15000 --subject-prefix commit-
is optional.
Save and exit.
Step 7
chmod a+x post-commit