Rob Kraft's Software Development Blog

Software Development Insights

Quickly Get Started With Subversion Source Control in April 2013 – Download, Install, and Use

Posted by robkraft on March 31, 2013

Once in a while I take over a software development project that is not using source code control. If I expect to make a lot of changes I usually set up source code control before I start so that I can easily revert changes I made if I need to. I don’t do this often, so I’m documenting the steps for a quick installation of subversion with minimal source control features for my own future reference.

I felt the urge to write this post for two reasons:

  1. To easily find the correct URLs to use to download the software
  2. To provide simple documentation for a simple installation. There is a lot of good extensive documentation explaining all the options, but I don’t care about most the options. I just wanted the basic installation so that I can get to work. And here it is.

Downloading and Installing the Version Control Software

A Google search for subversion will almost certainly take you to the old web site for subversion.  So skip it.  Download subversion from here:  http://www.visualsvn.com/downloads/  The first link is probably Apache Subversion Command Line tools, version 1.7.8 and about 2MB.  That is the one you want.  Ignore the misleading fact that it is has Apache in its name.  As a windows developer, that information is irrelevant, and frankly, misleading.  Download the file and unzip it to c:\program files\subversion.

Subversion does not include a user interface.  Everything is done from a command line.  So let’s get a user interface for subversion so that we can avoid hours making typos at the command line.  The challenge is to download TortoiseSVN without downloading the other crap put in front of you on the web pages.  This is not easy because huge download buttons will be placed in front of you on most the pages they force you to navigate through and they all download crapware.  So avoid the tortoiseSVN site and go straight here http://sourceforge.net/projects/tortoisesvn/files/latest/download.  This will download either the 64bit or 32bit version based on the OS you are running your browser.  Download it, then run the installer exe.  Take the defaults.

Creating a Repository to Store the “Master” copy of your software.

Now for the hard parts.  Subversion uses poor terminology, in my opinion, for  the actions you need to take to get started.  Conceptually, we want to do the following:

  1. Create a place on the computer to store the “Master Copy” of our source code, called the repository.
  2. Upload our existing source code into the repository
  3. Flag the working directory of our source code as a working directory for that repository.
  4. Make a change, test that subversion recognizes the change.

I recommend you back up your source code root folder to a backup folder at this time.

Create a folder on your computer to contain the Repository.  This is not going to contain the “working copy” of your code, it will contain the “Master” copy.  I recommend something like c:\SVNRepository.

Creating a Folder in Windows

  1. Right click on the folder you just created.  The TortoiseSVN tools should provide you an option to “TortoiseSVN\Create repository here”                             Create Repository Here for Subversion
    1. Do NOT click Create Folder Structure, just click OK.
  2. Now go to the root folder that holds your source code (let’s assume it is c:\DevSource).  Right-click, choose “TortoiseSVN\Import”

     Image of Import

    1. Clear the “URL of repository, then click the … button to the right”.  Navigate to the folder of your repository (c:\SVNRepository)
    2. Click okClick OK to import
  3. Now, to designate the location you imported from as the working copy of your project, right click on the folder you imported from again, and select SVN Checkout

    Checkout from Svn

    1. Careful – the “URL of repository” should be the full path to c:\svnrepository
    2. You may need to change the defaulted value for Checkout directory because the UI may add svnrepository at the end of the path name.  Take that off.  The checkout directory should be the root level of your project folder (c:\DevSource)
    3. It will warn you that the folder is not empty.  This is good – you are going to overwrite your existing project files with the files you imported into the repository.
    4. If you did this correctly, all your files will still contain their original date/times.
    5. If you did this correctly, and you right click on your project root folder, you will have two new options above TortoiseSVN on your menu, SVN Update and SVN Commit:

    Confirm SVN Folder

If you had any trouble, delete SVNRepository, copy the backup you made of your source files back into your project folder, and try again.

4 Responses to “Quickly Get Started With Subversion Source Control in April 2013 – Download, Install, and Use”

  1. aardvax said

    Nice tutorial, thanks.. it helped me getting started.. In my tortoise svn , i did not get update and commit in the menu until i checked out instead of an export .

    • With ‘svn export’ you simply export files from a repository to your filesystem without any SVN metadata. This means that you can’t update or commit anything since you don’t have a working copy. You need to perform an ‘svn checkout’ to checkout a working copy. Then you’ll be able to update / commit / whatever :).

    • robkraft said

      Ugh! Thanks Aardvax!! I corrected my post. It should be “Svn checkout” and not “Export”.

  2. Could you please clarify the “svn export” part of the instruction? You should perform ‘svn checkout’, not export! Or maybe I don’t properly understand your case.

    ‘svn export’ just gets a clean directory tree from a repository. No SVN metadata, so it’s not possible to update or commit. You need to checkout a working copy actually. http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-export.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 102 other followers

%d bloggers like this: