SubVersion update on commit


#1

Alright, I’ve read many other forums touching on this, but none pertaining directly to dreamhost and none with a solution that worked for me.

I want to use subversion to administer website development, but I want to set it up so that every time a developer commits, it updates the files on a development web server. This is to be done with post-commit, which is run after a user uploads changes.

Here is what I have in post-commit:

REPOS="$1"
REV="$2"

/usr/bin/svn update /home//dev..com

When I created the svn working copy with svn checkout file:///home//svn// /home//dev..com

My problem is that because the scripts are run as the “dhapache” user, it won’t update my working copy. Suggestions? Any help is greatly appreciated


#2

Ok, I figured out a way to make it work. Since CGI scripts are run as the user who created them, you can set one up to run the svn update for you. Here’s what I did:

  1. Created a script in a secured folder, in my dev site.

[/home/______/dev.______.com/scripts/commit-update.cgi]
#!/bin/sh

disable filename globbing

set -f
echo Content-type: text/plain
echo
echo “—++New Commit/Update+±–”
/usr/bin/svn update /home/.onion/icetek/dev.icetek-studios.com

then I setup my post-commit file like this:

[/home/______/svn/______/hooks/post-commit]
#!/bin/bash

REPOS="$1"
REV="$2"

wget -O - --http-user=RANDOM_STRING --http-passwd=RANDOM_STRING http://dev.icetek-studios.com/scripts/update-dev.cgi >> /home/______/status/post-commit-log.txt

This way, I get a log of every update made to the dev site. I will probably be using this for more then just this site, so I will probably make the cgi script more complex, and be able to update different sites, we’ll see. This works for now.


#3

Yup - works for me. At long last - i tried following directions on dreamhost wiki for post-commits and gave up trying to get it to work after 2 days. This one worked for me immediately. There is however a 40 second ‘hang’ at end of each commit - be nice to get rid of that.