Ben Summers’ blog

Converting simple svn repositories to fossil

I’ve been meaning to move from Subversion for some time, to get better merging and the benefits of a distributed version control system. While the most common choice is the unfortunately named git, it does have a lot of complexity, and in my opinion, too many choices over how it should be used.

Looking around, I’ve decided to try fossil. It looks like it has a nicer model for my purposes, and with ‘autosync’ mode, is a nice middle ground between a DVCS and a centralised system like subversion.

A big benefit of fossil is that it contains a distributed ticketing system and wiki. Not having to install something like trac (and all its dependencies) means one less bit of software to maintain, and of course, being distributed, it means the tickets and wiki can also be read and updated offline.

Of course, the first task is to convert repositories from Subversion to fossil. It amuses me that you have to do this with git, the system I’ve just rejected.

To start with, I’m only transferring my really simple repositories which don’t use tags and branches — just a simple top level versioned directory. I keep this blog in such a repository.

Installing fossil

fossil is wonderfully easy to install. Just download a prebuilt binary, or a zip file of the source and type make. However, it’s not totally obvious from the web site that if you choose the latter, you need to pick a version tagged with ‘release’, not just ‘any version’ as suggested.

Installing git

You need to install git and the git svn plugin. You only need these for the conversion process.

On Mac OS X, install MacPorts and type

  sudo port install git-core +svn

It will take a little while to download and build everything required.

Clone the svn repo into git

It took a little trial and error to create a nice clean version of the svn repository in fossil, with the svn usernames appearing neatly in fossil and without additional annotations on the log messages.

Create a new directory somewhere, and in it create a file called authors.txt. For every subversion user, create a line like this:

  ben = ben <ben>

Then, type (changing the username and URL as appropriate)

  git svn clone --no-metadata --authors-file=authors.txt --username=ben

This may take some time.

Convert the git repository to fossil

Type (changing ‘benblog’ into the name of your repository)

  cd benblog
  git fast-export --full-tree --all | fossil import --git benblog.fossil

If you don’t include the --full-tree option, any files which appear in the first revision but are never modified do not get included in the fossil repository. This may be a bug in fossil.

You now have a fossil repository, ready to configure and upload to a server.

And the final step is to use it to look after your code.



blog comments powered by Disqus


Hello, I’m Ben.

I’m the Technical Director of Haplo Services, an open source platform for information management.


About this blog


Twitter: @bensummers



Jobs at Haplo
Come and work with me!