Converting an SVN Repository to Bazaar

James Henstridge james at jamesh.id.au
Fri Jan 30 00:28:55 GMT 2009


On Fri, Jan 30, 2009 at 6:45 AM, A. S. Budden <abudden at gmail.com> wrote:
> 2009/1/22 James Henstridge <james at jamesh.id.au>:
>> On Fri, Jan 23, 2009 at 5:49 AM, A. S. Budden <abudden at gmail.com> wrote:
>>> This certainly looks very promising and I have now (sort of) managed
>>> to make a bazaar repository out of my existing repository.  I created
>>> a new "AlBranchCreator" that had an additional __init__ stage that
>>> read a list of project directories (e.g. applications/vim/vimfiles)
>>> from a text file and used this as the basis upon which to decide in
>>> the _want_brt method.  This went ahead and chewed for a bit and
>>> produced a functional repository.  The only problem with it is that
>>> the history only goes back as far as the repository reorganisation (as
>>> the 'filter' won't recognise trunk/configuration/vimfiles/ as being
>>> the same directory as applications/vim/vimfiles/).
>>
>> If your BranchCreator treats both trunk/configuration/vimfiles and
>> applications/vim/vimfiles as branches, then svn2bzr should follow
>> history if you did a copy/move from one location to the other.
>>
>> During the import process it literally copies the branch at the first
>> location to the other, so it should maintain history.
>>
>> Note that your BranchCreator should be returning False for paths
>> trunk, trunk/configuration, applications and applications/vim for this
>> to work though, or the copies won't be correctly traced.
>
> Thanks, this sort-of worked.  Some of the reorganisation parts came
> across cleanly, others appeared to be added rather than moved.  As far
> as I can tell this is because one of the major parts of my
> reorganisation was to lose the trunk/ branches/ tags/ part of the
> repository, so I did something along the lines of:
>
> svn mv -m "Repository reorganisation" svn://localhost/trunk/documents
> svn://localhost/documents
> svn mv -m "Repository reorganisation"
> svn://localhost/trunk/configuration/vim
> svn://localhost/applications/vim
>
> Since none of these directories are working paths (the working paths
> are applications/vim/vimfiles, documents/contacts,
> documents/university/thesis etc), it seems to treat these as
> independent add and deletes (although nothing appears in the log for
> the delete, even with --log debug), so the history starts with the
> repository reorganisation.

Yep.  I don't think svn2bzr is smart enough to handle those particular
moves.  With a bit of work, the tool could be extended to handle the
case, but I don't think anyone is actively working on it right now :(

> I guess I'll have to keep the subversion repository around in case
> it's ever needed.  Not the end of the world: at least I seem to have
> all of the projects accessible.  Having said that, if I can't browse
> my repository without having to memorise the structure (see my other
> thread), I can't see bazaar as being really usable yet, so I'll
> probably just end up sticking with subversion... we shall see.

Well, you should be able to do a conversion of the work prior to your
reorganisation by running svn2bzr on a partial dump.  You might be
able to use some other tool to stitch the branch halves together
afterwards (e.g. tailor).

James.



More information about the bazaar mailing list