4
votes

I'm looking for some help in using svn with web development.

Here are my questions.

  1. I setup SVN on my webserver, but keep my project files on my PC untill I'm ready to "commit" them correct?

  2. How do I get the "pushed" files I've sent to the server in my directory such as /home/site/public_html/ .. basically I'd like to "commit - push" files straight to my web directory. Is this possible?

  3. I don't really understand the full concepts of how this can work for web development. I have read at least a dozen guides but none of them really outline step by step what I need to do.

A step by step guide for the above issues, or a kind response to manually help me out would be really appreciated.

running windows 7 @ home (what I'm developing on) running CentOS 5 server (live webserver)

Thanks for any help.

3

3 Answers

3
votes

When you say:

basically I'd like to "commit - push" files straight to my web directory. Is this possible?

It sounds like you want to commit your changes to the SVN repository, and have them automatically get pushed to the web server. If that's true, you can accomplish this by using the SVN post-commit hook. On your system, in the SVN repository directory, this is a subdirectory called "hooks". Edit the one called post-commit.bat and have it do an export to your web server, something like:

svn export <svn_repo> <webserver_location>
1
votes

First off, I recommend you download Tortoise. It is an integrated desktop client for SVN. You can use this to commit your files to your repository.

As far as process goes:

  • Do you local development on your PC
  • When ready, commit the files to the repository
  • After committing, update your copy on your webserver from the repository. You will probably have to do this via the command line. Here is a link to the SVN command line: http://svnbook.red-bean.com/en/1.8/svn.tour.cycle.html

You don't want to use SVN like an FTP client. It is meant to be a version control system. So, the repository is the one true, master copy of your data. What is on your webserver and your local machine are copies of that data. The reason for this is that you want to have one copy that you know is a good, working copy. SVN will allow you to revert the code base back to any point in time, so it also acts as an archive.

The above scenario assumes that you are able to test and validate that your code is working on your PC. Do you have a version of your webserver running on your PC?

0
votes

you make your changes to your pages and do an svn commit on them to save those changes as a revision on the svn server. When you want to get a clean copy on the webserver do an svn export in the directory you want the files to be in. This is different from an svn checkout because it doesn't add all the .svn metadata files that svn uses in source control. This is also a downside because you need to export all the files every time. If you do an svn checkout in the directory all the metadata will be in the web directory too but you can easily remove them (with a script perhaps). This will allow you to just do an svn update in the web directory to pull all your future changes into the web directory.