RE: Checkouts - I think I've been doing it wrong for 3 years!
From: Keith Moore <Keith.Moore_at_securency.com>
Date: Fri, 14 Aug 2009 13:54:40 +1000
From: Steve Klett [mailto:sklett_at_pmddirect.com]
Hi, first post.
I am the only developer in my small company and have been using (hosted) subversion for 3+ years. When I first started using it I was coming from an old job where we used sourcesafe (v6!) so there was no concept of branches, tags, etc. While learning subversion (I read the red book and also purchased Pragmatic Version Control with Subversion) I remember reading about tags, branches and trunks and thinking it was interesting but never ended up using them. Until now. Well at least I want to.
Here's how I've been working, I created my local copy of my projects years ago and then added and committed that to the repository. Over the years I have just added more and more projects. I now have something like this on my local copy (same as working copy?)
as you can see there are no trunks or branches. That is easy enough to fix I think by adding the folders and then svn-moving my projects into the trunk.
What I'm REALLY confused about is the concept of a working copy and the way I've been creating a complete copy of my whole repository on my local machine. It's very "SourceSafe" of me to just do a giant update of everything I need so that's how I've always thought about it.
After reading about branching and the switch command I suspect I've been doing this all wrong. That I should actually be performing a checkout of the specific trunk or branch that I want to work on. So rather that checkout "PMD Repository" and get EVERYTHING I should create a basic directory and checkout only the trunk or branch that I want to work on. For example, if I wanted to create and work on a new branch of ProjectA I would checkout "PMD Repository\Tools\ProjectA\branches\somebranch" to my local folder "C:\PMD Repository\Tools\ProjectA"
In other words, I don't create the tree/branch/tag structure on my local machine.
Is this correct? What's made me question all this is the concept of "switching" which as I understand it sets your working copy (what exactly does that mean?) to the trunk/branch/tag that you choose. It lets users work on files without being concerned if they are on the trunk or branch.
To me this seems very confusing and dangerous - how do you KNOW what tag/branch/trunk you are working on?
What if I want to keep a working copy of trunk and a working copy a branch at the same time? As I'm sure you can tell I'm missing something. I've re-read the topics in the red book and read through my pragmatic book again and I'm still confused.
Any help GREATLY appreciated. At this point I'd even pay someone for some professional guidance on this - I really don't want to screw it up and lose anything and I want to understand how to use subversion correctly.
Thanks for reading!
You more or less have the jist of it. Where I work we have multiple projects all with a similar structure, such as:-
In our repository:-
We're a small team so we do all development on Trunk and do a copy (a branch is merely a copy in subversion) from there to "Tags/Release/*version number*". We copy the _whole_ of the trunk to the new folder. We also have a policy that you cannot change anything in the Tags directory, except copies of course.
In circumstances where we need to bug fix a release we copy the _Tags_ directory to the Branches/Re-Release folder, for example we'd copy Project1/Tags/Release/1.0.0/ to Project1/Branches/Re-Release/1.0/. We make the change in the branches directory and then do a new release, to Project1/Tags/Release/1.0.1/. This is not the recommended way from the subversion book and I believe we could do it better but this isn't giving us too much pain at this stage so I see no reason to change it.
Now, with regard to working copies and switching: We allow developers to checkout a project to any [local] directory on their development machine. They _must_, however, checkout the entire project whether that is trunk, a release or a branch. So using the example they would checkout Project1/Trunk to [on Windows] C:\Development\Project1\Trunk\, or Project1/Tags/Release/1.0.0 to C:\Development\Project1\Release-1.0.0\. It is up to the developer to manage their working copies and local file system. We agree to use the ProjectName/Trunk or ProjectName/Release-x.y.z format for working copies but it isn't enforced. When using this standard we find that we very rarely need to switch the working copy.
Working copy switching - when you checkout a working copy it is linked the location in the repository it was checked out from, switching means changing the locations to which a working copy points.
An example using Project1.
I checkout Project1/Trunk to C:\Development\Project1
I think switching only really makes sense in a scenario where you svn copy your working copy and then want to start working on that new subversion copy. In theory you can switch any working copy to any other part of the repository, but because of the changes between trees and files it will result in your working copy being a complete mess (someone correct me if I'm wrong about this).
Hopefully that's cleared it up for, at least a little.
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
This is an archived mail posted to the Subversion Users mailing list.