I have spent much of this evening (and, well, this morning) trying to convert a private Subversion repository into a public Bazaar repository hosted on Launchpad. This should be easy, and in a way it is, but there are a few pitfalls and alternatives which I thought I'd write up to save someone else the bother of figuring this out for themselves.
bzr-svn This is a Bazaar plugin which provides (semi-)native access to Subversion repositories from the usual bzr tool. I don't really need its myriad features for treating a Subversion repository as a Bazaar repository or vice versa, etc., but it also provides a command "bzr svn-import" which would appear to do exactly what I want. However...
- bzr-svn directly copies Subversion's author field to Bazaar's committer field. There is nothing wrong with this per se, except that it's not neat: Subversion authors are usually just UNIX usernames, whereas Bazaar's committers usually consist of a full name and email address. Launchpad, for example, will fail to associate commits which were converted in this way with a Launchpad account. I eventually fudged my way around this by dumping the Subversion repository (svnadmin dump), editing the dump file by hand to have Bazaar-style authors (fiddly - it's not designed to be human-editable!), and importing into Bazaar from that - but since the issue below was later deemed a show-stopper this effort was wasted. :-(
- bzr-svn writes an unusual sort of repository - specifically, one with rich-root data. Again, not really a problem per se; this behaves as a normal repository to a sufficiently-recent bzr (in fact it's also faster, apparently) and is at some point going to become the default. However the particular format bzr svn-import chooses to write (in my setup at least - bzr-svn 0.5.3 on Bazaar 1.13.1) cannot be read by versions of Bazaar prior to 1.9. For comparison, the version of Bazaar in Ubuntu 8.04.2 ("Hardy Heron") is 1.3.1. I consider this unacceptable; I'd like my repository to work for people who have a version of Bazaar older than a few months. It turns out also that whilst Bazaar can convert between some versions, it can't convert this particular repository format to one readable by version 1.3.1.
So, I went looking for alternatives.
svn2bzr At first glance, this shortish Python script seems like a poor imitation of bzr-svn with little to recommend it over the more official-looking plugin. However, svn2bzr has a trick up its sleeve: it can remap authors in a simple but effective manner.
It did turn out rather buggy, though; I hit two coding errors which prevented my use of the script until I figured out what the author was trying to achieve and made a few small changes. If you want my fixed version, it's
available in a Bazaar repository (of course ;-) ) which will hopefully be
merged upstream at some point. No guarantees that I've fixed the bugs correctly, as I wasn't at all familiar with the code, but it seems to have worked fine for me.