Converting an SVN Repository to Bazaar

Neil Martinsen-Burrell nmb at wartburg.edu
Wed Jan 21 16:46:17 GMT 2009


A. S. Budden <abudden <at> gmail.com> writes:

> I have been trying to convert my subversion repository to a bazaar
> repository, but I have been having some problems so was hoping that
> someone on this list might be able to help.
> 
> My (personal) subversion repository (which was originally a CVS
> repository) used to be organised with the root containing trunk/ tags/
> and branches/, but I (relatively) recently (and rather dramatically)
> reorganised it such that it has a number of directories and
> subdirectories with categories and then some project folders within
> those categories.  In two cases, those folders then contain trunk/,
> tags/ and branches/, but in most cases they do not (as I've not
> required them).  A short subset of the project folders is shown at the
> bottom of the email.

This is exactly the situation that my personal repository was in when I
created svndumpfilter4.  It is not an easy thing to split a monolithic
Subversion repository into separate Bazaar repositories when there have
been copies between the parts of the Subversion repository that you wish
to separate.  I did not have any luck using bzr-svn to complete the
conversion, because it cannot recognize the "branching scheme" used
in such a situation.  It may be possible to write a custom BranchingScheme for
your particular repository but I haven't done that.

> I have tried a few approaches to converting the repository, but had no
> success.  My first attempt was to use svn2bzr [1] on the whole
> repository: this produced a matching layout, but the only way I could
> get anything out of the bazaar repository was to check out the entire
> 1.5 GB repository!  

This was my experience too.  One possibility is to do this whole 
conversion and then make branches for each piece.  Then, for each
branch, delete everything else but what you want, renaming it to the
root after you delete it.  The downside to this is that you have a
pile of history that you have to drag around whenever you want to work
on a small piece of your repository.  The advent of stacked branches
makes this a particularly attrctive way of working because you can stack
all of your smaller branches on the omnibus one.  I haven't actually
tried this either.

> After some googling, I found "An Academic Gets
> Bazaar" [2], which sounded really promising.  So I downloaded
> svndumpfilter4 [3] and tried the suggested command line listed on the
> website:
> 
> svndumpfilter4 --untangle=./subversion applications/vim/vimfiles/ <
> svn-1917.dump > svn-1917-vimfiles.dump
> 
> However, the "untangle" option wasn't recognised (unsurprisingly I
> guess as it isn't in the optparse code at the bottom of the script!).
> Therefore, I removed this option and tried again.  After a fairly long
> wait, I ended up with a new dump file, so I entered the next two
> suggested commands:
> 
> svnadmin create repo-vimfiles
> svnadmin load --ignore-uuid repo-vimfiles < svn-1917-vimfiles.dump
> 
> As far as I can tell, this created a new repository that was identical
> to the original one, implying that svndumpfilter4 had simply copied my
> dump file!

There's a mistake in that article.  The untangle option isn't used.  I
would use::

svndumpfilter4 applications/vim/vimfiles < svn-1917.dump > vimfiles.dump

and check afterwards to see that the sizes of the two dumpfiles differ.
Then you can reload the dump as specified and see what you get.

[...]

> I am now feeling somewhat out of ideas so was wondering whether anyone
> could offer any suggestions as to how I might be able to proceed
> without starting from scratch and losing all of the history...

It is possible.  The svndumpfilter4.py script should be simple enough
to hack on to give you what you want and I would love to incorporate
any improvements you make.  It is currently at the state where I
finished my repository conversion and it could use some further
attention.

I would give some careful thought to the level at which you want your new
branches to be.  I ended up using a "software" branch for programs I've written,
even though it contains many separate projects.
When you decide where you want your branches to be, you can also used
shared repositories for those branches which have lots of revisions
in common.

-Neil





More information about the bazaar mailing list