bzr: ERROR: File id {TREE_ROOT} already exists

Bug #370710 reported by Roman Erzhukov on 2009-05-02
This bug affects 9 people
Affects Status Importance Assigned to Milestone

Bug Description

This occured when I trying to join second tree:

~$ bzr init --1.14 first
Created a standalone tree (format: 1.14)
~$ touch first/abc
~$ bzr add first/abc
adding abc
~$ bzr ci -m"add abc" first
Committing to: /home/roman/first/
added abc
Committed revision 1.

~$ bzr init --1.14 second
Created a standalone tree (format: 1.14)
~$ touch second/bcd
~$ bzr add second/bcd
adding bcd
~$ bzr ci -m "add bce" second/
Committing to: /home/roman/second/
added bcd
Committed revision 1.

~$ bzr init --1.14-rich-root third
Created a standalone tree (format: 1.14-rich-root)
~$ cd third/
~/third$ touch fgh
~/third$ bzr add fgh
adding fgh
~/third$ bzr ci -m"add fgh"
Committing to: /home/roman/third/
added fgh
Committed revision 1.
~/third$ bzr branch ~/first
Branched 1 revision(s).
~/third$ bzr join first
renamed file:///home/roman/third/first/.bzr to .bzr.retired.0
~/third$ bzr ci -m"join first"
Committing to: /home/roman/third/
added first
added first/abc
Committed revision 2.
~/third$ bzr branch ~/second
Branched 1 revision(s).

~/third$ bzr join second
bzr: ERROR: File id {TREE_ROOT} already exists in inventory as InventoryDirectory('TREE_ROOT', u'first', parent_id='tree_root-20090502041453-xifp6m061jk92qb2-1', revision=None)
roman@zeus:~/third$ bzr ls -v --show-ids
V fgh fgh-20090502041511-42kl7kn4qokz6p0s-1
V first/ TREE_ROOT
? second/

John Frankland (frankland) wrote :

I have exactly the same problem, but using format rich-root-pack for all three trees:

Robert Collins (lifeless) wrote :

We should update the docs to make it clearer how to recover from this. what you need is:
1) a rich-root tree
2) to have changed the root ID of one or both trees to be unique (a new branch in rich-root is fine, only upgraded branchs will have the default TREE_ROOT).

We may need a little script to change the tree root id for you.

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Martin Pool (mbp) on 2010-03-18
Changed in bzr:
status: Triaged → Confirmed
Martin von Gagern (gagern) wrote :

I assume that this bug here is the cause of the following error message:
bzr: ERROR: Cannot join <TREE>. Trees have the same root
According to "bzr file-id" the two trees involved both have TREE_ROOT as their root id as well.

Robert, could the change of tree root be performed as part of the join?
If doing so, would it still be possible to merge subsequent changes to the original tree into the joined tree, or would they have diverged due to the root rename?
In order to maintain mergability, from unjoined to both joined and unjoined trees, would one have to rename the root of one of the trees consistently in all its branches using that proposed script?
Would it make sense to allow users to specify the new root id as a config option to the upgrade command?

Martin von Gagern (gagern) wrote :

The attached plugin can be used to set the root id of a branch. Simply save it as ~/.bazaar/plugins/ It works for joining. Haven't checked other consequences yet, so it might well break things. If it does, don't blame me, for you use it at your own risk.

Thanks to James Teh for the corresponding code in question #71563.

Martin von Gagern (gagern) wrote :

Did some experiments with the attached plugin. Seems a change of root id constitutes a local modification that has to be committed. The commit will list all direct children of the root directory as renamed, although old and new name are the same. Once committed, the change will propagate accross pushes and pulls, but not accross merges. If root ids of branches disagree, files added to the root directory of one will cause an error message when merged into the other, but the files end up in the root directory of the other nevertheless, so it might all work out well enough.

Still, all of this is far from pretty, and it would be really great if there were a simpler solution to get joins of upgraded branches working.

tags: added: 2a join
Dimitri John Ledkov (xnox) wrote :

This 2a this works and you do not need to commit after joinging first/ you can branch and join second/ and have two pending merge tips. I think this is because we have branch_roots as well now.

Changed in bzr:
status: Confirmed → Fix Released
HRJ (harshad-rj) wrote :

This still doesn't seem to work with 2a as stated in comment #6

I tried the original commands, tried with and without the plugin, with and without committing the join as mentioned in #6. Still nothing.

I am using bzr version 2.3.4

Brian Aker (brianaker) wrote :

What version is this fixed in?

At least as of version Bazaar (bzr) 2.4.2 this seems to still not work.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions