1
votes

I'm trying to make subversion automatically deploy the current working copy upon commit.

eg, if someone checks out the 'public_html' repo and then commits a change, I need SVN to automatically run 'svn update /path/to/public_html/' on the server running svn.

I've set up a post-commit hook that calls:

/usr/bin/svn update /path/to/public_html/

I've ensure the post-commit hook is executable, and if I manually run the script via SSH it runs properly and updates the /path/to/public_html/ dir, so we know the post-commit script works fine.

The problem I'm encountering is that whenever I commit, I get this error:

Transmitting file data .svn: Commit failed (details follow):
svn: MERGE of '/svn/public_html': 200 OK (http://ourdomain.com)

Thing is, SVN is lying through its teeth: the commit does NOT actually fail - if I manually update the dir (or manually run the post-commit script) the update completes and the changes are reflected on the server.

So, does anyone know why my post-commit hook is failing?

I've seen a fair bit of posts on this subject but none seem to have any solutions apart from "try running the post-commit script manually" which I've tried and it works fine.. So the post-commit script isn't the problem, it seems to be a problem with SVN itself.

Any help would be greatly appreciated!!

2
This doesn't directly answer your question so I'm including it in a comment rather than an answer -- I would recommend against running your public http server content against a svn repository directly. Instead, you should use a build-and-deploy script, which packages up your code and content and moves it to a publish location. Making an automatic tie-in to commits sounds especially scary - what if someone checks in a code error, or a rude typo in a writeup? You never get a chance to test the changes before they go live.Ether

2 Answers

1
votes

You have to be aware that in hook script no environment does exist..which means you have to use absolute paths in your scripts instead of the command, cause you have no path either. Are you sure to use a post-commit, cause the post-commit can't fail a commit only pre-commit and start-commit can do such a thing.

0
votes

Check whether the userid of the svn server process has enough rights on /path/to/public_html/ to write files and directories.

Another idea: It needs also access to its own repository, as stated in the working copy "/path/to/public_html/". If you use svn+ssh or http protocol, you may want to change this to file protocol - its on the same server anyway.