bzr: ERROR: File id {TREE_ROOT} already exists in inventory

Asked by John Frankland

I get this error when trying to do a second "bzr join" to add a subdirectory to the main directory of my project.
The problem seems to come from the fact that in my original subdirectory standalone trees (which were imported from CVS by tailor), when I look in their .bzr/checkout/dirstate file, they all have a line like this near the top:

<nul><nul><nul>TREE_ROOT<nul><nul>...

whereas if I create a new standalone tree I see that the corresponding line is like this:

<nul><nul><nul>tree_root-20090522124002-yuqlri6cb...

How can I "sanitize" these trees to get rid of the TREE_ROOT ?

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
Aaron Bentley Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Martin Pool (mbp) said :
#2

Sorry, I don't know how you can change the tree root for an existing branch; abentley may know.

Revision history for this message
Martin Pool (mbp) said :
#3

I'm going to expire this because it's so old.

Revision history for this message
Martin Pool (mbp) said :
#4

Old question

Revision history for this message
Graham Poulter (grahampo) said :
#5

Wait! I have this problem too. The TREE_ROOT comes in because the branch was created in an old, pre-rich-root version of Bazaar.

New rich-root branches don't use TREE_ROOT. However, the conversion from old formats to rich-root formats retains TREE_ROOT, preventing more than one such repo from being joined into the tree.

Old repos that are upgraded to 2a (rich root) retain the TREE_ROOT file ID and so only one of them cannot be join'ed. I think that's a bug.

Revision history for this message
Aaron Bentley (abentley) said :
#6

It's not pretty, but it can be done. You have to get rid of the existing tree root by creating a subdirectory, moving everything into it, and then splitting it out:

~/sandbox/foo$ cd bar
# create a hidden directory so that * later won't match it
~/sandbox/foo/bar$ bzr mkdir .newroot
added .newroot
~/sandbox/foo/bar$ bzr mv * .newroot
baz => .newroot/baz
qux => .newroot/qux
~/sandbox/foo/bar$ bzr split .newroot
~/sandbox/foo/bar$ cd ..
~/sandbox/foo$ mv bar ~/junk
~/sandbox/foo$ mv /home/abentley/junk/.newroot/ bar
~/sandbox/foo$ bzr join bar
renamed file:///home/abentley/sandbox/foo/bar/.bzr to .bzr.retired.0
~/sandbox/foo$

Revision history for this message
Aaron Bentley (abentley) said :
#7

I provided an answer

Revision history for this message
Graham Poulter (grahampo) said :
#8

I managed to fix it differently, by editing .bzr/checkout/dirstate with a hex editor (recommend: ghex2)

Just delete the "TREE_ROOT" string and replace it with one like "tree_root-20100218155450-vob92vvorxgnuqed-1" (using some random text between the timestamp and the -1 to keep them unique)

Can you help with this problem?

Provide an answer of your own, or ask John Frankland for more information if necessary.

To post a message you must log in.