TortoiseSVN: Right-Click Context Menus Not Available

Problem: You install TortoiseSVN and find that the right-click context menus and icon overlays are not available!

Solution: Check if you have installed 32-bit TortoiseSVN on 64-bit Windows 7. If yes, uninstall it and install the 64-bit TortoiseSVN.

Explanation:

TortoiseSVN installs itself as an extension to Windows Explorer. The 64-bit Windows Explorer on a 64-bit Windows 7 installation cannot load or communicate with 32-bit TortoiseSVN to display context menus relative to the selected files and directories.

Mercurial: Import Subversion Project

Mercurial is a distributed VCS (DVCS). If you are planning to migrate from Subversion to Mercurial, it might be better to do this on a per-project basis. Due to the nature of a DVCS, it is better to spin off each of your Subversion projects in the repository as separate Mercurial repositories. Here is how:

  1. If you have not already done so, make a copy of the Mercurial configuration file (Mercurial.ini) and add your username. See this post on how to do this.
  2. The command to convert repositories is hg convert. It will not work unless the convert extension is enabled. To do this, open your Mercurial.ini and in the [extensions] section uncomment the convert = line. It should read:
    [extensions]
    convert =
    
  3. The default Windows binaries of Mercurial cannot import from Subversion. If you attempt a hg convert using this binary, you will see an error:
    $ hg convert file:///C:/SVNRep/FoobarProject
    Subversion python bindings could not be loaded
    

    You will need the Python bindings of Subversion and Mercurial installed on top of a standalone Python to be able to do this. That is too messy! But, there is an easier alternative to this. Install TortoiseHg, the Explorer extension to Hg. Its hg.exe has been built with all the necessary bindings. Issue the convert command using its hg.exe:

    $ "C:\Program Files\TortoiseHg\hg.exe" convert file:///C:/SVNRep/FoobarProject
    
  4. This should work. If your Subversion project has been cleanly maintained with the canonical trunks, branches and tags structure hg convert can import all of that correctly into the Mercurial structure of tags.

Subversion: Remove a Project

There is no straightforward way to remove all the information of a project from the SVN repository and retrieve that diskspace. The only way to achieve this:

  1. Dump the repository to a dumpfile.
    $ svnadmin dump C:\Foo_Rep > C:\foo_rep_dump
  2. Filter out the project you want to remove from the dumpfile.
    $ svndumpfilter exclude Project_to_del < C:\foo_rep_dump > C:\foo_rep_dump_updated

    If you have many projects that you want to remove, repeat this step for each of them.

  3. Create a new repository.
    $ svnadmin create C:\Foo_rep_new
  4. Load the updated dumpfile to new repository.
    $ svnadmin load C:\Foo_rep_new < C:\foo_rep_dump_updated

TortoiseSVN: A Quick Start Guide

I have been an avid user of TortoiseCVS for many years now. It has been the single most important influence for me to like version control systems. Every version control tool I had used before it had made me cringe and swear. Last week, I switched to using TortoiseSVN for my source code files. Like TortoiseCVS is built upon CVS, TortoiseSVN has been built upon a much more advanced version control system called Subversion.

Why did I switch? There are certain operations which are difficult or impossible in CVS/TortoiseCVS. If you rename, add and delete files inside your project, then CVS struggles to maintain versions of those. Since I have used some very advanced version control systems like Clearcase before, I knew CVS had reached its limits of use for me. I had to move on to Subversion.

When I did move, I found that there are not many guides out on the Internet which provide the minimum number of steps required for TortoiseCVS users to switch to its new brother TortoiseSVN. I aim to do that below with some simple steps and screenshots.

Installation

Download TortoiseSVN and install it.

Repository

First, we need a repository to hold the versions of our data. Say you want to create a local repository (one that exists on your harddisk). Create an empty directory to hold the SVN repository. Right-click inside it and choose TortoiseSVN → Create Repository here. Choose Native Filesystem (FSFS) in the next dialog. The repository is created!

A Simple Project

I will assume you have a bunch of files or folders all nicely managed inside a single folder which you want to manage as a project.

Lets lay the groundwork for your project. Open Repo-browser by right-click and choosing TortoiseSVN → Repo-browser. Provide the path to your repository in the URL section.

Create a new folder for your project. Give the name of your project to this folder. Now, here’s the bit where SVN differs from CVS. Create 3 folders inside the above folder named trunk, tags and branches. trunk will hold your data most of the time. tags will hold your tagged data and branches will hold your branched data.

Importing Your Project

Clean the folder you wish to import into the repository by removing all unnecessary files and folders inside. Right-click on the folder now and choose TortoiseSVN → Import. Choose the location of your repository. Choose your project name and choose trunk. We are importing our files into the main trunk of the repository tree. The tags we create and branches we create in the future will reside on the tags and branches respectively but will derive from the trunk.

Working Copy

Now that all our project data has been imported into the repository, we can check out a working copy to any place we want and start working! Create a new folder with any desired name. Right-click on this folder and choose TortoiseSVN → Checkout. In the repository section choose your project’s trunk folder and checkout.

You can modify and commit the files inside this working copy folder just like you did in TortoiseCVS.

Tagging/Branching

Tagging is a bit different in SVN. Right-click and choose TortoiseSVN → Branch/Tag. In the To URL section, choose your project’s tags folder and append a tag to it there. Use the same kind of …/tags/… path when you wish to checkout this tagged data. This is how tagging is different in SVN.

To merge back a branch to trunk, go to the trunk checkout and merge the branch “to” it.

I hope that with the preliminary information given above, you can get started with TortoiseSVN.