Broken SVN Post Commit on Joyent Accelerator

Posted by nick.stielau on April 14, 2008

I was trying to remove and add lots of files (unfreezing/freezing Rails 2.0), and subversion was just being a pain. It would go through all of the motions for committing, including actually committing the code, but then it would error and leave my working copy all confused.

........
Adding         vendor/rails/actionpack/test/template/tag_helper_test.rb
Adding         vendor/rails/actionpack/test/template/text_helper_test.rb
Adding         vendor/rails/actionpack/test/template/url_helper_test.rb
Adding         vendor/rails/actionpack/test/testing_sandbox.rb
Transmitting file data ............................................................................................................................................................................................................................................................................................................svn: Commit failed (details follow):
svn: MERGE request failed on '/svn/source/Geartracks/trunk/vendor/rails'
svn: MERGE of '/svn/source/Geartracks/trunk/vendor/rails': 200 OK (http://svn.nickstielau.com)

I googled around for a little and found a helpful article on Ubergeek. They found that a failing post-commit hook script would cause this error. And then I remembered, checking something on my Joyent Accelerator Webmin panel when I was creating the svn repository.

This is where I turned on the post-commit, which broke my checkins

I looked around a little and found the post-commit hook that webmin created for me:

[nickstielau:~] admin$ sudo cat /home/svn.nickstielau.com/svn/source/hooks/post-commit
Password:
#!/bin/sh
EMAIL="my_email@gmail.com"
REPOS="$1"
REV="$2"
/opt/webmin-1.340/virtualmin-svn/commit-email.pl --from my_email@gmail.com -s "SubVersion commit" "$REPOS" "$REV" "$EMAIL"

No problems there. Looking at the perl script, we find a configuration section:

PERL:
  1. ######################################################################
  2. # Configuration section.
  3.  
  4. # Sendmail path, or SMTP server address.
  5. # You should define exactly one of these two configuration variables,
  6. # leaving the other commented out, to select which method of sending
  7. # email should be used.
  8. # Using --stdout on the command line overrides both.
  9. #$sendmail = "/usr/sbin/sendmail";
  10. $smtp_server = "127.0.0.1";
  11.  
  12. # Svnlook path.
  13. my $svnlook = "/usr/bin/svnlook";
  14.  
  15. # By default, when a file is deleted from the repository, svnlook diff
  16. # prints the entire contents of the file.  If you want to save space
  17. # in the log and email messages by not printing the file, then set
  18. # $no_diff_deleted to 1.
  19. my $no_diff_deleted = 0;
  20. # By default, when a file is added to the repository, svnlook diff
  21. # prints the entire contents of the file.  If you want to save space
  22. # in the log and email messages by not printing the file, then set
  23. # $no_diff_added to 1.
  24. my $no_diff_added = 0;
  25.  
  26. # End of Configuration section.
  27. ######################################################################

I wasn't sure if I had an SMTP server running locally, but I could easily check sendmail.

[nickstielau:~] admin$ which sendmail
sendmail is /opt/csw/sbin/sendmail
[nickstielau:~] admin$ which svnlook
svnlook is /opt/csw/bin/svnlook

So I commented the SMTP line and put the the appropiate paths to svnlook and sendmail.

$sendmail = "/opt/csw/sbin/sendmail";
#$smtp_server = "127.0.0.1";

# Svnlook path.
my $svnlook = "/opt/csw/bin/svnlook";

Booyeah. Emails on commits. Also notice the two configuration settings there, no_diff_deleted and no_diff_added, to configure how detailed the commit emails are.