Simple Subversion SCM for Private Projects

I recently found myself looking for a well integrated, well supported, simple SCM (Software Configuration Management) system for my private development projects.

The list of SCM systems out there is daunting.  Some are just garbage, some work well, some used to work well but are getting increasingly difficult to find versions compatible with the latest operating systems.

My requirements were really pretty simple, or so I thought…

  • Must not require running any source control server to access stored configurations, although the ability to run an source control server remotely or on another networked system would be a bonus
  • Repositories must be simple to copy, relocate, backup and restore
  • Must support at least basic branching and merging
  • Must support Atomic commits or change sets without manual tagging
  • Must support a high quality integration with Visual Studio 2005, 2008, 2010
  • A migration path from CVS for importing older CVS repositories
  • Simple to install and get running with minimal configuration.

Essentially, I wanted a simple, safe SCM system that works for the individual developer.  I don’t need or care for large team support and didn’t want the admin headaches associated with many of those systems.  It has to “just work” and not get in my way.  I also need to be able to easily grab a zip of the repository, toss it on a laptop and take it with me and be able to work offline.

The solution I chose is SubVersion (SVN).  Here’s how to get it running on a Windows system (x86 or x64) in less than 10 minutes.

Here are the components I’m using:

  • TortioseSVN – Integration with Windows Explorer
  • AnkhSVN – Integration with Visual Studio

With TortoiseSVN, I installed both the x86 and x64 msi packages since they install nicely side by side and allow nearly seamless support for both 32-bit and 64-bit applications.

AnkhSVN supports all versions of Microsoft Visual Studio and like TortoiseSVN, is a virtually zero-configuration install.

Getting Started (Still being cleaned up, so bear with me)

These are simple zero-config installers.

  1. On an x64 system, Install all three to allow both x86 and x64 apps to be svn aware.   On an x86 system, skip the x64 installer. 
    • AnkhSvn-xxxx.msi
    • TortoiseSVN-xxxx-x64-svn.msi
    • TortoiseSVN-xxxx-win32-svn.msi
  2. Reboot in order to have the TortioseSVN fully integrated with the Windows Explorer.
  3. Create a folder for the new Repository.
    • I suggest choosing a repository location near the root of some drive since you’ll use a simple file system URI to access it.  Also suggest that you use a path containing no spaces in the names, although SVN has no trouble with this.  It lets you avoid having to use quotes should you use any SVN commands from the command line in the future.
          ex:  C:\SVN-Repository
  4. Next, we need to turn this newly created folder into a SVN repository.
    • Select the C:\SVN-Repository folder in the explorer and pick the following option on the right mouse context menu:
         RightMouse->TortoiseSVN -> ‘Create Repository Here’   
  5. So, now the folder has the necessary stuff in it to make it a repository.  Next, we’ll browse it with the Repository Browser and create our project areas.
    • With SVN-Repository folder still selected, browse this new repository using this context menu command:
         RightMouse-> TortoiseSVN -> ‘Repo Browser’
  6. The First time you bring up the repository browser you may need to specify the url to the repository you’re going to browse.
    • In the Repo Browser, in our example, make sure the path to our repository points to:  file:///C:/SVN-Repository
  7. In the Repository Browser, select the top node in the Left Pane in the repository and RightMouse->’Create Folder’ to create a top level source folder.  Do this for each individual source tree or separate project you want to maintain.
         ex:  MyMusicApp
  8. Next Step is to prepare your existing source code tree for adding to SVN.  Let’s assume you had your code for the MyMusicApp in a C:\Projects\MyMusicApp directory.  The easiest way to get this into SVN is to perform an IN-PLACE Add & Commit of everything in your existing source code tree.  But first you should remove all the bin, obj and junk folders and files that are automatically created when you build that you don’t want added.  If you miss a few, that’s ok as you can remove them from the repository later.  You can also edit the file exclusion list in the SVN options to specify certain types of files that should not be checked in.  This is a good idea in general.
  9. Here we’re going to put our existing source tree under revision control.  To do this, we have to tell SVN to check out our new empty MyMusicApp project into our existing source directory.  Remember, there’s nothing yet checked into our MyMusicApp repository, so we’re effectively checking out zero files.  But what this step does for us is add the SVN support files needed to attach our working source folder to the MyMusicApp project under revision control.
    • RightMouse->SVN Checkout…  
    • Specify the URL to the repository’s source folder in the dialog:  file:///c:/SVN_Repository/MyMusicApp
    • Also be careful to LOOK at the checkout folder it lists. This should point to C:\Projects\MyMusicApp in our example, since this is where our existing source lives.
    • Again, you’re going to do a fetch of the empty MyMusicApp project into the folder where your existing Source lives. Just ignore the warning about nothing to fetch.  SVN will not overwrite anything, it just connects this working area to the repository we just created.
    • Click ok to do this empty checkout.
  10. Next, go Back into the Repository Browser so that we can place all the existing files under revision control. 
    • To do this, select the project folder MyMusicApp in the Left Pane that we created earlier.
    • RightMouse->’Add Folder’  (not Create folder)  and browse to C:\Projects\MyMusicApp containing existing source you want to add.
    • This has “added” the files as items to be committed, but we need to “Commit” these folders/files to make it happen. You could unselect some of them if you wanted to skip a few.
  11. Back In Explorer, browse to C:\Projects\MyMusicApp and you’ll see that there are some folders with a Blue Plus sign icon.  Select each top level folder that has a BLUE + icon and commit them by using:  RightMouse->’SVN Commit…’    NOTE: Add a comment if you like, and review the files to commit before letting it run.
  12. Fire up Visual Studio.  Go into Tools->Options, and make sure “AnkhSVN” is selected as your source code control provider.  Load up your MyMusicApp project.  You should see that any files that live somewhere in this MyMusicApp folder have a “Checkmark” icon indicating that they are up to date.  If you edit/save one of these, you’ll see it gets a different icon to indicate it has been modified but not checked in.  Pick the menu option: View->’Pending Changes’.  This is where you’ll see each file you change showing up.  Since checkins are atomic and committing a batch of changes increments your current configuration number by 1.   
  13. The rest of the UI in Visual studio is very intuitive.  You can connect Winmerge or your favorite diff/merge tools so they’re launched instead.
This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published.