Repo format conversion strategy?

Doug Lee dgl at dlee.org
Tue Jan 6 11:27:38 UTC 2026


This post explains my solution to messages like this in a major bzr-to-Git conversion of mine:

> missing tree dc9fca88268e3cd15cdec53564a33d288c17a173
# seen on "git fsck" if not sooner

This problem is finally resolved, but the method is surprising enough to me that I thought I might ought to post it in case it helps anyone else.

Thanks, btw, that brz still works on a Git repo - I still find it easier for some tasks.

Summary: I manually created the missing tree in a small branch, and that made all other branches import correctly.

Method used:

1. Binary search for problem:
cd (path of bzr branch)
rm -fr temp
bzr push -r<n> temp
# Try to convert temp to Git using git-remote-bzr plugin
# Found all commits through 290 worked and 291 did not.
# Used git fsck to prove each case.

2. Find out what the bad commit did:
bzr log -r291 -p
  291 Doug Lee	2012-04-18
      Directory reorg to ease import of iniparse code.
      === renamed directory 'iniparse-0.4/iniparse' => 'iniparse'
      === renamed directory 'iniparse-0.4' => 'iniparse/iniparse-0.4'
# Don't ask; I had some interesting methods in 2012 I'm sure. :-)

3. Manually recreate tree:
# temp was left as a conversion of commits 1-290 into Git.
cd temp
git mv iniparse-0.4/iniparse iniparse
git mv iniparse-0.4 iniparse/iniparse-0.4
git commit -am "Manual replay of bzr commit 291"

4. Move this branch out of the way:
git branch -m main fixup

5. Import real branches:
Now the git-remote-bzr plugin could import all branches of this project without a missing tree.
git fsck, git gc --aggressive --prune=now, etc., worked fine after all branch imports.

On Tue, Dec 23, 2025 at 02:54:50PM -0500, Doug Lee wrote:
Update on my repo conversion problems:

For the below push operations, I am using brz 3.3.17 and Python 3.13.3.

I have converted over 200 brz/bzr workspaces to Git successfully using the remote-vzr approach (fastimport very often died with missing-file errors). I have three or four repos so far that refuse to cooperate though.

Using "bzr push --lossy" does successfully create a Git repo, but "git fsck" fails with messages like this:

broken link from    tree d9bdc6dfd71df839730aee3cfea2dd9d28a8943e
              to    tree dc9fca88268e3cd15cdec53564a33d288c17a173
dangling tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
missing tree dc9fca88268e3cd15cdec53564a33d288c17a173

I also still see no tags in the Git repo.

Unfortunately these are not public repos, but I wonder if there is anything I can do to either rescue them or help brz address the issues I'm seeing.

On Thu, Nov 06, 2025 at 06:39:19AM -0500, Doug Lee wrote:
On Thu, Nov 06, 2025 at 02:05:03AM +0000, Jelmer Vernooij wrote:
On Wed, Nov 05, 2025 at 01:34:47PM -0500, Doug Lee wrote:
>> I've experimented with converting from .bzr to .git format for some of my projects, but encountered these roadblocks:
>> 
>> * The fastexport | fastimport techniques fail with file reference errors.
>> * Modifying that to use marks (an AI suggestion) taught me that Git can't read a brz marks file (without massaging that I didn't do, perhaps).
>> * reposurgeon fails with a reference error to what looks like a branch or folder name.
>
>> * brz push --lossy to a git inited repo works but sends over zero of my tags.
>
>This should be fixed in the latest versions of Breezy; 3.3.11 is too old.

Ah, got me!  Ubuntu has not updated that package but I forgot to look for updates outside of apt.



-- 
Doug Lee                 dgl at dlee.org                http://www.dlee.org
"Never does the human soul appear so strong as when it foregoes
revenge, and dares forgive an injury." --E. H. Chapin



More information about the bazaar mailing list