开发者

subversion within web development with centralised web server

I 'm basically confused as to how to export the latest files to my web server. I work with 3 other developers at work开发者_Go百科 so subversion is a must really. We liked the idea that subversion allows multiple users to edit the same file.

Pushing from subversion to web server

This guy says use svn export but wouldn't that messup if multiple people commit at the same time. Could I do something clever with the commit hook script?


An SVN export grabs the current version of the repository (or, a specific version if you specify) and drops it onto the local file system such that it is not actually under version control. What this means is that if you do an export, you cannot subsequently do a checkin from that exported directory (because it lacks the .svn folders that are required for talking to the central SVN repo).

You can create a post-commit hook that will automate this process for you - such that the web server always has the most recent version out of the repository. It doesn't matter if people "commit at the same time", because SVN treats it as atomic operations. In the end, you would end up with the most recent version on the web server.

There can be problems with this - if someone introduces a problem, or a bug, or hadn't done a get latest themselves and therefore screwed something up, then this automatically gets pushed to your webserver. For obvious reasons, this type of thing is avoided for production web servers - but really it boils down to what your own needs are.

Depending on your development environment and webserver environment, you might also look into something like Capistrano. It can be a bear to setup if you work from windows, and almost but impossible if your webserver is also Windows. But, if/when you do get it setup, its wonderful - it'll handle all the "connect via ssh, cd to correct directory, do export" and any other task that you want to automate for a deployment.


If you only want to export your personal changes to your own server then you should develop on a seperate branch to the other developers. You export that branch to your local server and then merge the branches when you are ready to share your changes.

However, I would encourage you to all work on the same branch if it's feasible because the longer you put off merging the more of a pain it is.

Does that answer your question?


I would use CruiseControl to build your project. You can have your SVN trunk and a branch for production. When someone checks in to trunk, you can have it automagically build a dev.domain.com site, and then when you check into the production branch, have it automatically build that site as well. It also gives you an easy way to roll back if you have issues on production.

http://cruisecontrol.sourceforge.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜