threads / discuss / 25764

How to import bzr repository into git

Subject: How to import bzr repository into git

## tl;dr

8 messages between Nov 16, 2010 and Nov 19, 2010.

replies: 7people: 4as markdown or json

Dmitri Pissarenko· Nov 16, 2010, 19:57 UTC · lore
Hello!
I want to migrate one of my projects from Bazaar to git, preserving the history.

How can I do that in Windows (import an existing Bazaar project into a new/empty git repository) ?

Thanks in advance
Dmitri
Ævar Arnfjörð Bjarmason· Nov 16, 2010, 20:05 UTC · re: Dmitri Pissarenko · lore

Re: How to import bzr repository into git

On Tue, Nov 16, 2010 at 20:57, Dmitri Pissarenko <dmitri.pissarenko@gmail.com> wrote:

> I want to migrate one of my projects from Bazaar to git, preserving the history.
Have you looked at some of the migration tools already?
Which ones? Why do you think they work / don't work for you?
> How can I do that in Windows (import an existing Bazaar project into a
> new/empty git repository) ?

You don't need to do it on Windows. You can install VirtualBox + Linux for free and do it there. That's probably easier in some cases than porting the relevant software to Windows.

Gabriel Filion· Nov 17, 2010, 00:22 UTC · re: Dmitri Pissarenko · lore

Re: How to import bzr repository into git

On 11/16/2010 02:57 PM, Dmitri Pissarenko wrote:
Show 7 quoted lines
> Hello!
> 
> I want to migrate one of my projects from Bazaar to git, preserving the history.
> 
> How can I do that in Windows (import an existing Bazaar project into a
> new/empty git repository) ?
> 

Have a look at "bzr-fastimport" [1]. it's a Bazaar plugin that can help you to transform the bzr history into a git one.

[1]: https://launchpad.net/bzr-fastimport

I haven't done a lot of testing with shared-tree Bazaar repositories (a repository with multiple branches in it) but I suspect it would not work very well with such a layout.. If you're doing a one-time conversion of a one-branch repository, it works pretty well.

Once Bazaar and the bzr-fastimport plugin are installed, you mostly need to run those commands :

    git init project
    cd project
    bzr fast-export --export-marks=../bzr.mark /path/to/old/bzr/project
| git-fast-import --export-marks=../git.mark

you now have, in the new git project, a "master" branch with all the history from the bzr repository and all tags.

-- 
Gabriel Filion
Jonathan Nieder· Nov 18, 2010, 16:37 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: How to import bzr repository into git

Ævar Arnfjörð Bjarmason wrote:
> On Thu, Nov 18, 2010 at 15:34, Dmitri Pissarenko
> <dmitri.pissarenko@gmail.com> wrote:
>> However, I had to give up this idea due to an "out of memory" error
>> during bzr-export.
>
> Buy more memory or use more swap?
Or report it as a bug/wanted feature?

Cc-ing Jelmer Vernooij in the hope that he might be able to point you to the right person for that.

Thanks, Jonathan

Jonathan Nieder· Nov 18, 2010, 16:38 UTC · re: Jonathan Nieder · lore

Re: How to import bzr repository into git

Jonathan Nieder wrote:
> Ævar Arnfjörð Bjarmason wrote:
>> On Thu, Nov 18, 2010 at 15:34, Dmitri Pissarenko
>> <dmitri.pissarenko@gmail.com> wrote:
Show 9 quoted lines
>>> However, I had to give up this idea due to an "out of memory" error
>>> during bzr-export.
>>
>> Buy more memory or use more swap?
>
> Or report it as a bug/wanted feature?
> 
> Cc-ing Jelmer Vernooij in the hope that he might be able to point
> to the right person for that.
This time with a valid email address (sorry for the noise).
Gabriel Filion· Nov 19, 2010, 21:34 UTC · re: Jonathan Nieder · lore

Re: How to import bzr repository into git

On 11/18/2010 11:38 AM, Jonathan Nieder wrote:
Show 16 quoted lines
> Jonathan Nieder wrote:
>> Ævar Arnfjörð Bjarmason wrote:
>>> On Thu, Nov 18, 2010 at 15:34, Dmitri Pissarenko
>>> <dmitri.pissarenko@gmail.com> wrote:
> 
>>>> However, I had to give up this idea due to an "out of memory" error
>>>> during bzr-export.
>>>
>>> Buy more memory or use more swap?
>>
>> Or report it as a bug/wanted feature?
>>
>> Cc-ing Jelmer Vernooij in the hope that he might be able to point
>> to the right person for that.
> 
> This time with a valid email address (sorry for the noise).
right! I did see this with this particular workflow:

bzr branch lp:bzr git init bzr.git cd bzr.git bzr fast-export ../bzr | git fast-import

the weird thing is that using fastimport directly with the lp:bzr address (not "logged in" to launchpad, so in practice via HTTP) instead of a local copy of the directory took a very long time but worked.

So I guess there's probably a memory leak when using local files.

other than bzr-fastimport, there is also bzr-git, which seems to support some form of pushing (bzr dpush).

There are also mentions, in different discussions, of tailor:
http://wiki.darcs.net/RelatedSoftware/Tailor
And finally, the git wiki mentions BzrToGit
https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#BzrToGit

However, I have not thoroughly tested these tools and I have yet to find something that works right in all cases. If you give these tools a try, I'd be glad to hear about your experience with them.

-- 
Gabriel Filion

← back to recent threads