ource control is an important aspect in software development even if you are not doing team development. It can help you manage your application more efficiently and make sure that your project is backed up and can be rolled back to any state on the file or project level. I recently got acquainted with the open source Subversion and Tortoise SVN tools, and—for the first time—feel that this is source control that I can live with comfortably. This article describes all you need to know to get started with Subversion and Tortoise SVN for Visual Studio projects.
You'll see how to install and configure the Subversion source control tool and a walkthrough of the basic steps required to set up local Visual Studio projects using Tortoise SVN. Note that this article isn't meant to be a comprehensive tutorial on Subversion; it's a quick, what-you-need-to-know, step-by-step installation guide.
What Is Subversion?
Subversion is an open source control repository tool. It is widely used by many open source projects and increasingly by many large development teams in general. It's fast and efficient, small and easy to install. and because it's open source—it's also free. Subversion is file based and keeps its repository in a simple directory structure that you can copy and back up easily.
You can graphically access Subversion via Tortoise SVN, which is an Explorer Shell Extension that provides access to most of Subversion's command-line interface through Explorer Context menus and overlay icons for files under source control. This is very powerful as it lets you use a familiar Explorer interface as your source code browser and, more importantly, because it very easily lets you see source control files in relation to the actual directory structure and what is and isn't under source control.
Subversion subscribes to the Copy-Modify-Merge philosophy of source control, which means that files are never locked and nobody ever "owns" a file. Instead, Subversion manages changes by merging source files with any changes made, and notifies you of conflicts only if there are changes that cannot be merged (such as conflicting changes to the same line of code).
|Tortoise SVN is a GUI front to Subversion that runs as an Explorer shell extension.|
Coming from a background of using integrated security in Visual Studio, the merge approach seemed doubtful at first; however, it turns out that it smooths the development process considerably, because you don't have to worry about constant check-out/check-in scenarios and locking files for other users. Instead, you simply work on your code, and when you're done you can check in all changes using Tortoise SVN. Not having source control inside of Visual Studio may sound like blasphemy if you've used Visual SourceSafe, Vault, or another integrated source code control provider. I was skeptical about lacking Visual Studio integration when I started out, but I find I really don't miss the integration with Visual Studio. More importantly, I don't miss the problems that go with integrated source control in Visual Studio, where the provider manager often gets confused, especially in complex Visual Studio solutions and shared project scenarios. Using Subversion has simplified many irritating scenarios that formerly required constant fiddling with Visual Studio and the source providers.
Subversion is based on a file system tracking mechanism, so it is essentially tool agnostic. In fact, I now use Subversion with both .NET projects and my old FoxPro projects—the process is identical, which helps with consistency. Subversion also allows storage of all sorts of files, from documentation to support files, that otherwise wouldn't be part of a Visual Studio project.
|Editor's Note: This article was first published in the July/August 2008 issue of CoDe Magazine, and is reprinted here by permission.|