Christopher Bennage

Sponsors

The Lounge

Wicked Cool Jobs

Syndication

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Subversion for Source Control

Background:
We've been using Subversion for source control on our extensive ASP.NET project for the last year. It was the fourth tool we tried, and the one that stuck. We have an automated build process and a distributed team. Our repository resides in Minnesota and we have developers in Florida.
We started about 18 months ago with Visual Source Safe, and poor WAN performance led us to try Source OffSite as well as SCCBridge. SOS worked well, but I wanted to investigate free alternatives. SCCBridge was free and looked promising, but I could not get it to work with our server.
We then installed a demo of SourceGear's Vault. I liked the fact that it had a SQL back end. Performance was better that SOS (slightly), but we had a problem with sessions timing out. If you've never seen it, check out their movie trailer.

I've was also evaluating TargetProcess at the time and their road map included integration with Subversion. (I think it was originally slated for November 2005, it's now planned for January 2007). When the demo for Vault was about to expire, and after reflecting on the minor problems, I decided to to install Subversion.

About Subversion Clients:
The trick with Subversion is that there are multiple clients available and you'll need to find the client that is the best fit.
At first we choose two: TortoiseSVN and AnkhSVN.

Tortoise seems to be the overall favorite of the community. It integrates into Windows Explorer. At first, I found this a bit strange, but I quickly got used to it. It provides a rich interface as well as diff/merge tools and frequent updates

Ankh is a plugin for VS.NET. It does not use the SCC API, so I avoided it at first. (Not using the API means that VS.NET doesn't know that the files are under source control.) I did try SVN SCC Proxy, a commercial client that uses the API, but it has special needs. I have decided that I did no mind VS.NET being ignorant about the source control, if you've ever dealt with the Change Source Control dialog box you'll probably agree. (Note: I was still using 2003 at this time.)

I stopped using AnkhSVN after Visual Studio 2005 came out because of compatibility problems, however their sites says that the current release is compatible. Tortoise meets most of my needs. The biggest inconvenience is that when adding new files to your solution\project you have to remember to add them to source control manually. (This could be a big hassle depending on how you work.)

Alternatively, there's a new player on the field, VisualSVN, moderately priced at $19 and integrating with Visual Studio, it looks very promising. However, it is still new and is not yet full featured. Keep an eye on it though.

Of Special Note:
I'm not going to walk through the entire setup process, but rather point out a few caveats. I do recommend not being lazy; read through the manual that comes with Subversion. (The product is different enough from the VSS/SourceGear model to be confusing.)

The most important thing to note is the standard Subversion client (and hence all the third party clients) used a hidden directory to store metadata about files under source control. The directory is labelled .svn.
This chokes an ASP.NET application. Well, it did with 1.1, I haven't tested it with 2.0.
Tortoise provides a special option during their install to use _svn instead. Likewise, Ankh provides a configuration that allows you to specify the directory name. Do not use Ankh to add anything to a repository until you have modified the config file to use _svn.

Subversion uses a Copy-Modify-Merge model. I was used to the CheckOut-Modify-CheckIn model and did not want to try CMM. However, after a week of use, I don't think that I will go back. It is very nice to be able to work when I don't have an Internet connection to my repository.

If you're used to VSS, get acquainted with the difference of vocabulary. Here's a quick cheat sheet:
Check Out - Get an initial working copy. Only used when you're setting up things on your dev client.
Export - Get a clean copy of the project. This means that the local copy with not be under source control.
Update - Get the latest version. This merges changes from the repository into your working copy. It also merges changes into files you've modified, but does not remove your modifications.
Commit - Sends your modifications to the repository.

Finally, be cautious when it comes to renaming, deleting, or moving files. You will want to use the commands provided by your chosen SVN client. Using the native functions or doing things outside of VS.NET can lead to inconsistencies.

PS
During our Subversion setup something caused a problem with Internet Explorer. New Windows would not open properly. Here is an easy fix.

I also recently found msbuild  integration for Subversion at http://msbuildtasks.tigris.org/.  However, I was "integrating" previously using .bat files. 


Posted 10-04-2006 11:43 PM by Christopher Bennage

[Advertisement]

Comments

kwalters wrote re: Subversion for Source Control
on 10-05-2006 1:22 AM

I too found issues/quirks with using AnhkSVN with Visual Studio 2005 so I stopped using it. However my boss pointed me to the following url:

http://vorpal.cc/blog/category/development/tortoisesvn-in-visual-studio.html

this makes using subversion within visual studio a little more convenient by putting Tortoise commands into a toolbar.

mgrzeg wrote re: Subversion for Source Control
on 10-05-2006 4:38 AM

.bats? ;) Nice :)

I did some research looking for convenient tool for svn integration in my build process. I use deeply nant. So my first steps were to Nantcontrib repository, where I found an svn task (provided with help of one of bloggers here - Marcin Hoppe) , which simply executes svn.exe with some params. I was not satisfied with this solution, so I got interested in ankh sources (available freely).

NSvn.Core + NSvn.Common -> well documented by unit tests -> in Core we have the Client class, which covers most of my needs (checkouts, commits, etc.)

For example:

   public class Test

   {

       public void checkout()

       {

           Client client = new Client();

           client.AuthBatton.Add(AuthenticationProvider.GetSimplePromptProvider(new SimplePromptDelegate(this.PasswordPrompt), 3));

           client.Checkout("url", "local", Revision.Head, true);

       }

       private SimpleCredential PasswordPrompt(String realm, String username, bool maySave)

       {

           return new SimpleCredential("user", "passwd", true);

       }

   }

is a simple class which lets us checkout Head revision of the code from repository with simple credentials.

I think, you may try to investigate the source code of ankh addin and find better solution than .bats. But - if they work well, and you don't need anything more - just leave it, and my post may be helpful for someone who hasn't tried yet svn in his job, but needs some integration with unattended build process.

Joe Niland wrote re: Subversion for Source Control
on 10-05-2006 5:15 AM

Thanks Christopher - that is really useful information. I've been using svn for a while to keep my personal projects safe (on cvsdude) with the RapidSVN client. The lack of VS integration is a bit annoying although not as much with smaller projects - especially the adding a new file or renaming an existing one as you mentioned. Anyway as a replacement for good old cvs it is definitely a great tool.

Jim Bolla wrote re: Subversion for Source Control
on 10-05-2006 11:03 AM

VS.NET 2005 does not have the problem with the .svn folders like 1.x did.

TortoiseSVN is our preferred client. And the trick to add the Toroise icons right onto your VS.NET is really nice.

One thing that it currently doesn't handle well is when you rename a file in VS.NET, the change history gets broken as SVN thinks the original file has been deleted and a new file was created. The next version of Tortoise is slated to include a feature to relink these files before committing. I'm looking forward to that very much.

Bob Yexley wrote re: Subversion for Source Control
on 10-05-2006 2:03 PM

I heart Subversion.

shahkalpesh wrote re: Subversion for Source Control
on 10-06-2006 3:50 AM

Can anyone describe basic Source code control options in a simplified manner wrt SVN?

For e.g. I would like to know, how to label (VSS way) in SVN?

Also, what are the other options in SVN & what do they mean?

I will be really thankful to you

Michal Grzegorzewski wrote re: Subversion for Source Control
on 10-06-2006 4:35 AM

@shahkalpesh: Official & free: http://svnbook.red-bean.com/. Very good with very pragmatic approach is also this one: http://www.pragmaticprogrammer.com/titles/svn2/index.html.

shahkalpesh wrote re: Subversion for Source Control
on 10-06-2006 7:10 AM

Thank you mgrzeg.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)

CodeBetter.Com