Page 1 of 1

Subversion commit to update files

Posted: Thu Apr 12, 2007 7:54 pm
by jwalsh
Hi,

Our current project has grown to a larger team of developers than we normally work with, all working off of a central testing server in our office. On this server is our basic framework, and the development environments for the applications. I've used other version controls systems before, but this is my first experience with subversion, and I'm wondering how to accomplish this....

I have setup the necessary repositories on the server, and given the proper authentication to the users. Works great. However, since so much of our code is centralized on the server, each person is not working with a local instance of PHP, they are all testing against the development box. When someone makes file changes, and commit's them to the repository, all the delta's are stored in subversion, but the files themselves are not updated. Of course, nobody can test their code this way.

How can I setup subversion so that when files are committed, the actual files are updated so we can test the code that was just written? Isn't this how subversion should work?

Thanks,

Josh

Posted: Thu Apr 12, 2007 11:52 pm
by feyd
Subversion has commit hook events that can be used to run a script that will run an update from a given location thereby updating all the files.

Posted: Fri Apr 13, 2007 2:35 am
by RobertGonzalez
Just a suggestion (which can be easily accomplished)... create a development and testing environment on your server(s) that is different from production. Have four stages of development: 1) local, 2) development, 3) test and 4) production. This gives every developer and opportunity to develop locally, push to a production copy set up in dev, then commit to code control with post commit hooks that push to test where it can be tested, then pushed to production after testing.

It seems like a lot of fail safes, but when you break it down like that, you can see the potential benefits, even to the use of test as a warm back up to prod in the event of a catastrophic failure on the prod server. Just an idea thrown out there for you.

Posted: Fri Apr 13, 2007 7:32 am
by jwalsh
Everah,

That's precisely what we have. Each person tests their code individually on their machine when possible, but because of the large amount of shared files on the development environment, not all testing can be accomplished locally. I'll check into these hooks that feyd mentioned.

Josh

Posted: Fri Apr 13, 2007 12:48 pm
by jwalsh
Ok, I think I'm on the right path here, but I'm stumped.

I've created the post-commit file in the hooks subdirectory, with the following contents

Code: Select all

#!/bin/sh
                  
cd /home/account/public_html/
/usr/bin/svn update --username user --password pass
Do I need to chown the target directory to run as the same user as svn? If so, what user would that be?

Thanks

Posted: Fri Apr 13, 2007 1:10 pm
by jwalsh
It works! The post-commit file needs to executable :-p Silly me!