[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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]
Sent: Friday, August 14, 2009 12:34 PM
To: users_at_subversion.tigris.org
Subject: Checkouts - I think I've been doing it wrong for 3 years!

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?)

Code:
C:\PMD Repository
    \Tools
        \ProjectA
        \ProjectB
        \ProjectC
    \Forms
        \Stuff
        \More Stuff

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!

-Steve

------------------------------------
Hi Steve,

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:-
Project1/
Project1/Trunk/
Project1/Trunk/* source code whatever
Project1/Branches/
Project1/Branches/Re-Release
Project1/Tags/
Project1/Tags/Release/
Project1/Tags/Release/1.0.0 copy of the trunk at the time of the release
Project1/Tags/Release/1.1.0 etc.

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 make some changes and now I'm ready to release so I update my working copy, resolve any conflicts, build, test, etc. and then commit my changes to the repository.
Next I svn copy Project1/Trunk/ to Project1/Branches/Dev1/CrazyIdea/ because I have an idea to do something a bit different but I don't want to effect the Trunk code base.
I've copied but my working copy still 'points' to Project1/Trunk/ so I 'switch' my working copy to point to Project1/Branches/Dev1/CrazyIdea/ and then svn update to make sure the working copy is up to date.
Now when I make changes to this working copy and commit them they go to the Project1/Branches/Dev1/CrazyIdea part of the repository rather than trunk.
When I finish my changes on CrazyIdea, if they are good and they work I can 'merge' my changes back into trunk and 'switch' my working copy back to trunk. If my changes weren't a good idea I can just delete my branch and working copy.

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.
Keith Moore.

#####################################################################################
Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from any system and destroy any copies.
#####################################################################################

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2383517

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-08-14 05:57:01 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.