Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a working copy and what does "switching" do for me in Tortoise SVN?

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 named this snapshot. I also created 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 repository checked out, is that it?

like image 314
KingNestor Avatar asked Feb 24 '09 10:02

KingNestor


People also ask

What is switch in SVN?

A switch moves your working copy through time and space. Because svn switch is essentially a variant of svn update , it shares the same behaviors; any local modifications in your working copy are preserved when new data arrives from the repository. This allows you to perform all sorts of clever tricks.

What does SVN copy do?

svn copy (cp) — Copy a file or directory in a working copy or in the repository.

How do I find my SVN working copy?

The working copy will be located in a directory called trunk on your computer relative to the directory you issued the command in. If you wish to have a different name for your working copy you can add that as a parameter to the end of the command. e.g. This will create a working copy called MyProjectSource .

What command is used to obtain a local working copy of an SVN repository?

SVN Checkout – Create working copy Checkout command is used to download sources from SVN repository to working copy. If you want to access files from the SVN server, checkout is the first operation you should perform. SVN checkout creates the working copy, from where you can do edit, delete, or add contents.


2 Answers

A working copy is the copy you have checked out to your working area. It doesn't matter if it is a branch or from the trunk. It's 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, what's 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.

like image 119
ng. Avatar answered Sep 21 '22 03:09

ng.


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.

like image 29
Jim T Avatar answered Sep 22 '22 03:09

Jim T