Subversion commit to update files

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Subversion commit to update files

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post 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
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post 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
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

It works! The post-commit file needs to executable :-p Silly me!
Post Reply