views:

757

answers:

5

Alright, lets get back to SVN 101.

I have a software app and I've hit an important milestone, version 2.0.

I decided I want to tag this version as "Version-2.0" so I have this named snapshot. I also create a "Version-2.0" branch in case I need to fix anything and merge it back into my trunk.

After reading through the Tortoise SVN help file, it informs me that I can switch my "working copy" to a newly created branch.

What does this mean?

Presently, I have:

/Project/Trunk/
/Project/Tags/
/Project/Branches/

All checked out. So what would be the point of "switching"? Currently, I just go to my /trunk folder and do my work. And when I made my tag and branch, it created folders in my /Tags/ and /Branches/ folder after I did an update.

Why wouldn't I just go to /Branches/Experiemental-v3.0/ and do my work there if I wanted to?

Can someone explain the concept of "Working Copy" and "Switching" to me? What am I missing? Do people generally not have the whole respository checked out, is that it?

A: 

Your working copy is any folder on your hard drive that you've used to check out a project from subbversion. You can "switch" to a different project for that working copy, so that the versioned contents will resemble the contents of that other project.

This is useful to switch from trunk to branch, without having to check out a new copy. It can for example save you some build time, since the unversioned files (your compiled objects, libraries, executables) are not removed or changed.

Dave

Dave Van den Eynde
+1  A: 

Working copy is your copy of the code, that you have checked out. Normally, you'd check out just /Project/trunk/, not the whole structure of the repository. Switching is changing your working copy's root. The way you work with SVN is not how it should be done.

vartec
+5  A: 

A working copy is the copy you have checked out to your work area. It does not matter if it is a branch or from the trunk. Its what you are working on.

You can switch between branches (or more correctly copies) of the same parent with svn switch. This will basically say, whats different between the current working copy and the branch I am switch to. It then performs an update on your current working copy to the revision of branch you switch to.

So working copy is your checkout, however it was obtained.

Switching is just changing the branch your working copy commits to, think of it like changing the pointer in the repository where your commits will go. With the aid of acquiring any differences from the branch to your work area.

ng
+1  A: 

You have checked out the whole project tree - this is probably not what you want. For the trunk work, check out a copy rooted at 'trunk', not from the project root. Similarly, for branch work check out only the branch you want.

anon
+3  A: 

It's generally unnecessary to have the whole repository checked out. Branches and tags in subversion are intended to be cheap - ie, they don't create copies of identical files, just reference them. When you've got the whole repository checked out, when anyone branches or tags for any reason, it's suddenly multiplying the space used on your local hard drive.

You can have as many parts of the repository checked out as you need to. So you could have a folder called 'trunk' which is a working copy of just the trunk, another 'version2' which would be a working copy of your branch. This way, any additional tags which are created don't get checked out.

Or you can have one checkout called 'project', and if it's originally pointing to trunk, you can switch it to one of the branches or tags - it's a way of re-using the original checkout so that you don't have to get everything all over again.

It can be quite useful to do this you're working on trunk and suddenly realise you need to commit your changes to a branch - perhaps because they got too experimental. To do this, branch from your working copy, switch to the new branch then commit and your changes will go to the branch rather than trunk.

Jim T