简体   繁体   中英

How to use the branch and trunk in SVN with the dev server?

I develop in PHP with NetBeans. The modifications are uploaded to a virtualized LAMP dev server on my machine directly by NetBeans.

I would like to branch some developments.

The problem is that only the trunk is sent to the server.

I use a classic structure:

{svnroot}/trunk 
{svnroot}/branches 
{svnroot}/tags 

How can I test the branches without doing a crazy branch/trunk swap (with all the possible conflicts)?

  • Is there a solution with an htaccess configuration?
  • Should I use SVN differently?
  • Should I use NetBeans differently?

Most SVN setups have a few top-level directories

{svnroot}/trunk
{svnroot}/branches
{svnroot}/tags

If you lack the "branches" top-level directory, add it. Then use svn copy to copy in all the contents from "trunk".

If your web server pulls the code in such a manner that your "branches" directory gets pulled into the web server, that's a deployment issue concerning your web server, and whoever set that up needs to fix it.

Sometimes a person side-steps having a release plan by doing a svn checkout of the code directly into the web server. While that works for a very limited number of cases, it reduces your ability to handle future events without migrating to a more sophisticated release plan. If your environment tends to do something like this, you might be able to continue to follow your plan by selectively checking out only the sub-contents of "trunk", or you could migrate to a proper "build" of your release, which then goes through a "deployment plan".

If you lack the "trunk" directory, before attempting anything, you might have to create the "trunk" directory and move all of the current contents into it. This means that all development would need to checkout from the "trunk" subdirectory instead of the {svnroot} directory. This is done by extending your URL (adding "/trunk" to the end).

I hope this gets you thinking along the right paths.

You could checkout everything onto the web server, and use symbolic links (or junction points with Windows servers - see Junction.exe from www.sysinernals.com ) to switch between test/production environments. Or yes, you could use .htaccess to change where your web root points to. As others have said, it's usually a good idea to have separate test/production servers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM