Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding branch use with Visual Studio 2010, AnkhSVN, and SVN 1.7.4

I am a complete newb to Subversion, but am trying to get past the frightening shadow of SourceSafe. So I'm learning, trying to teach myself what's what, and I've come across some roadblocks I don't quite understand yet.

SVN 1.7.3 is up and running on a local Linux box. AnkhSVN is installed within my VS 2010 setup. VS/AnkhSVN can talk to my repository. So I started experimenting with some very simple Console projects to get started. I created the trunk, branches, and tags directories as suggested in the guidance I've found so far.

I created a new Console solution, and allowed Ankh to create that project in my repository under the recommended "trunk" folder. After adding nothing more than a "Hello, World" line to Program.cs, I commit the changes to trunk. That works...so far, so good...

I'm now wanting to pretend I'm working on a private branch, so I select Subversion->Branch Project... from "trunk" and the "Head/Latest" version, checking "Switch to Branch after creation." That seems to go well.

Problem 1.

Now here's where things get dicey. I decide to add a single source file to the project in my private branch, adding the file, but I cannot get the file to move from my private branch to trunk. Merging/reintegrate doesn't work. Update doesn't work. Switch doesn't work. Now, after trying a switch from the branch to the trunk, VS tells me my project file is corrupt and can't be loaded.

Obviously, I've done something terribly wrong, but I don't know what. It appears I just need to get a trunk working copy, then do a merge, but how do I do that in my VS project folder setup?

Problem 2

My next problem, or question, which may be part of Problem 1, is understanding how Subversion-managed projects should be structured on the Visual Studio side. Its much clearer to me on the Unix side that you can pull a project into a local folder, but its not at all clear how the typical directory structure of a VS project is supposed to be affected by Subversion. Should the trunk and branches folders be duplicated on the local Visual Studio box as well? If I "switch" from trunk to a private branch (or vice-versa), is the intent that the corresponding files should be going into the same set of VS folders, or should there be a corresponding set for the branches and for the trunk?

Problem 3 This is more of a newbie SVN question, but when SVN tells me there are conflicts, I don't yet understand how to resolve them. Does the ankhSVN plug-in have special tools to resolve conflicts, or do I need to fix them on the host server with the full svn tool? If so, what's is the "most typical" kind of conflict to resolve?

like image 592
David W Avatar asked Oct 09 '22 01:10

David W


2 Answers

First thing to do: read at least the first two chapters of Version Control with Subversion and play with the examples. To do the latter it's better to use a command-line client, such as Slik SVN.

AnkhSVN on its own is not enough for an SVN client - it's just a convenience tool for integrating SVN into VS. So if you'd like to use a GUI client (in addition to a command-line client, that IMHO is a must in any case), then most popular one for Windows is Tortoise SVN.

(Actively) reading Version Control with Subversion will help you with all your current questions, but here are some initial thoughts:

Problem 1 Did you commit your branch? You can make sure by running svn info [repo_url]/branches/[your_branch]

Problem 2 It seems that there is some misunderstanding on you part: SVN also 'pulls' (the term is 'check out') your files locally. Read the book!!!

In general, your SVN structure should reflect your folder structure, not vice versa. Also generally you work on only one branch at a time, and have only one branch checked out. When you need to work on another branch you do 'svn switch'. It conserves space. Now, of course you can check out all of your repository starting at the repo root, but why would you do that? (I can think of such situations, but they are more concerned with repository maintenance, rather than with a regular workflow).

Problem 3 Conflicts - not even worth talking about until you read the book.

I hope this will point you in the right direction. Reading the first two chapters of the book should take you anywhere from couple of hours to couple of days.

like image 98
malenkiy_scot Avatar answered Oct 13 '22 11:10

malenkiy_scot


  1. Did you add and commit the file?

  2. You could use switch to the keep same folder, as given in the example here or you could have two separated folders for your trunk and branch. It's up to you and what works for your project. It may be better to use switch if your project has to be in a certain path to work, for example a Web service.

  3. Unfortunately I don't have Ankh in front of me, but you should be able to edit or resolve conflicts with a tool built into Ankh, but you could change the configuration to use a 3rd party tool as well. Documentation here.

like image 35
WhiteKnight Avatar answered Oct 13 '22 12:10

WhiteKnight