views:

36

answers:

2

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!!

+1  A: 

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.

khmarbaise
Wrikken
Thanks, and yes the commit is succeeding even though SVN says it's failing, it's just the post-commit hook itself that is failing.I'm aware that there's no environment. The content of the script is:---#!/bin/sh/usr/bin/svn update /web/ourdomain.com/dev/public_html---
1337ingDisorder
A: 

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.

Turbo J
Permissions are all ok.I wasn't aware you could update a checked out copy of a repo using file://So if the path is /web/ourdomain.com/dev/public_html/ I could just use file:///web/ourdomain.com/dev/public_html/ instead of the raw path and SVN would treat it differently?
1337ingDisorder
use ''svn switch'' or ''svn switch --relocate''
Turbo J
Not that I would not use a working copy as public html root, but an export (via "svn export") since this will eliminate those ".svn/" directory entries.
Turbo J