tags:

views:

366

answers:

4

How can i make an svn trunk on my subversion as DocumentRoot for my VirtualHost, so I can test my application based on the latest code on the trunk. (My application is written in PHP).

Thanks!

+1  A: 

I'm not sure you'd be able to do that as svn only stores the changes to files, not the whole files (I think).

You can however set up post-commit hook scripts, so then when you commit the script is executed, i.e. a folder like stage.domain.com runs svn up and gets the latest version of the codebase.

http://svnbook.red-bean.com/en/1.1/ch05s02.html

Might be what you're looking for.

Adam

Adam Taylor
A: 

EDIT: I think I misunderstood your question. You cannot point the document root to the SVN repository, but can point the document root to a directory into which you checkout the SVN trunk.


That's no problem. You should however protect your .svn directories so that they cannot be accessed via the webserver.

<DirectoryMatch "^/.*/(\.svn|CVS)/">
    Order deny,allow
    Deny from all
</DirectoryMatch>

The above will work for Apache in its server configuration, its vhost configuration or in an .htaccess. You can achive the same effect with the URL rewriting module in IIS7. Other webservers will surely provide some comparable features.

Stefan Gehrig
A: 

Take a look at SvnFs (which uses FUSE, or derivatives such as macfuse).

I've never used it, and I wonder if accessing the trunk this way is a good idea. For example: does SvnFs actually make changes to the trunk visible (or would the trunk be fixed to a specific revision upon mounting)? If it does show the changes, does it show them right away, or only if the file is actually requested (I assume that if the web server checks if a file's timestamp has changed, then that would trigger SvnFs to return the latest details)? And above all I assume SvnFs would yield a read-only file system (if not, then I'd not use it...), so what if your web server wants to create some files?

(Hmmm, actually there's also Cascade for FUSE, which provides read-write access...)

Arjan
A: 

Btw, I already solve the problem using post-commit hook script, i write the steps on my blog :

http://wildanm.wordpress.com/2009/04/22/draft-simple-continuous-integration-symfony-subversion/

Wildan Maulana