skip to Main Content

I am trying to convert this Bazaar repo to Git.

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

But I get this error:

22:10:43 Calculating the revisions to include ...
22:10:43 Starting export of 2952 revisions ...
22:10:43 1000/2952 commits exported at 448681/minute 
...
22:10:43 1000/2952 commits exported at 239415/minute 
fatal: Path onboard/copying not in branch
fast-import: dumping crash report to .git/fast_import_crash_3847
brz: broken pipe

fast_import_crash_3847

Tried bzr and Breezy, two different OS (Arch Linux and Ubuntu).

2

Answers


  1. That is a bug in the fast-export functionality of bzr.

    In revision 1 the directories python-virtkey-0.3/ and sok-0.23/ were added, among other things including the file sok-0.23/copying.
    In revision 2 python-virtkey-0.3/ was renamed to python-virtkey/ and sok-0.23/ to onboard/ and thus sok-0.23/copying to onboard/copying.
    In revision 56 then onboard/copying was renamed to COPYING.

    The problem is, that fast-export emits only this for revision 2:

    commit refs/heads/master
    mark :2
    committer Henrik Nilsen Omma <[email protected]> 1155815101 +0100
    data 18
    rename and cleanup
    from :1
    D python-virtkey_0.3.dsc
    D python-virtkey_0.3_i386.changes
    D sok_0.23.dsc
    D sok_0.23_i386.changes
    

    It misses to iterate the renamed directory and emit renamings for each individual file in them.

    To work-around the problem, you would need to find all such directory renames in the repo history and fix the fast-input stream accordingly. If you do so, be aware that the fast-import format also contains binary data, so you might not be able to do this with a text editor without breaking the binary files.

    If you check with bzr log -v | grep '/ =>' you see that there were 14 directory renamings and you would need to manually fix all of them to work-around the issue.

    Even if you do not get an error message, the result might be wrong without fixing it, as then the renamings are not done and if a file then would have been edited after the rename, the first commit actually creates it while the old file still remains present and so on.

    So the best way is probably to report the bug if not already done and wait for a proper fix, and then closely investigate the conversion result to make sure there are not more such issues that maybe do not result in a failure but just in a wrong result.

    The bug should be this one: https://bugs.launchpad.net/brz/+bug/1890216
    with a fix already available at: https://code.launchpad.net/~cjwatson/brz/fastimport-fix-directory-renames/+merge/410767
    since 1.5 years, but noone seems to bother integrating it.

    Login or Signup to reply.
  2. Instead of fast-export, you can also use Breezy’s native support for pushing to Git:

    % bzr branch https://code.launchpad.net/onboard onboard-bzr
    Branched 2295 revisions.
    % git init onboard-git
    Initialized empty Git repository in /tmp/onboard-git/.git/
    % cd onboard-bzr
    % bzr push --lossy ../onboard-git
    Pushing from a Bazaar to a Git repository. For better performance, push into a Bazaar repository.
    All changes applied successfully.
    Pushed up to revision 2295.
    15 tags updated.
    % cd ..
    % diff -ur onboard-bzr onboard-git
    Only in onboard-bzr: .bzr
    Only in onboard.git: .git
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search