views:

319

answers:

4

I'm having a slight issue wrapping my head around on how to set up Subversion when working with php files. I store all my files at c:\www[nameOfProject]\htdocs and I setup virtual hosts for each project. (c:\www\project1\htdocs\index.php maps to http://localhost/project1/index.php).

How do you guys handle using SVN? Lets say I have c:\svnrepos\ which is where I store each repo for each project. Now ideally I would want to check out from the repo at c:\svnrepos\project1 to c:\www\project1 correct? But the docs say to do it to an empty directory, but how can I preview my code then without moving it somewhere else first?

Thanks for the help guys!

+2  A: 

An empty directory does not imply c:.

Therefore you can safely have a repository at c:\svnrepos\project1 and checkout to c:\www\project1 to work.

BenB
+2  A: 

You can do what you want. If your repo is at at c:\svnrepos\project1 then you can check a fresh working copy out to c:\www\project1, which should indeed be empty.

how can I preview my code...?

Preview the code by checking it out to some other directory. For example, check it out to c:\www\preview\project1, with an appropriate virtual host set up.

Bennett McElwee
+3  A: 

One way of doing this effectively is to do your development by checking out the trunk into, say, c:\www\preview\project1 and testing it with an appropriate virtual host or different url there.

As you get it working, you will be checking in various versions of the trunk. When it's ripe to move over to your "real" host/url, then you

  1. Create a branch or a tag to reflect this (like branches/rel.1), and
  2. Check out (svn co) the branch into c:\www\project1\htdocs

After that you can do urgent bug fixes under branches/rel.1, and merge them back into ongoing work under trunk. When another release is ready, you

  1. Make another branch (say, branches/rel.2), and
  2. Switch (svn switch) c:\www\project1\htdocs to the new branch

This way, you can keep your development from interfering with the real service, and also switch back to an earlier release if you have problems.

For a more complicated, but urgent, bugfix, you can

  1. Check in your development as trunk
  2. Switch c:\www\preview\project1 to the current release branch
  3. Fix and test the bug in c:\www\preview\project1, committing as necessary
  4. When satisfied, do the final checkin, then svn update on c:\www\project1\htdocs
  5. Switch c:\www\preview\project1 back to trunk, and carry on developing
Brent.Longborough
Thanks for all the help guys, you all gave me valuable insight into the subject.
patricksweeney
+1  A: 

If you already have an instance of the app checked out to C:\www\project1 and you want to preview some changes you did since you made that checkout without altering the existing app, then yes, you'll need to create a new empty directory to check out the files into (or you could move the existing C:\www\project1 elsewhere, create a new empty C:\www\project1, and check out into that)

However, if you don't need both the new changes and the original version of the app available simultaneously, you could always use SVN to update the working copy at C:\www\project1 with the changes you've made. If you don't like them, just revert that working copy back an earlier version.

David Zaslavsky