Another weird merge error...

John Szakmeister john at szakmeister.net
Sat Aug 14 15:29:09 BST 2010


First, let me give some background.  I'm trying to use Bazaar for
long-term, disconnected, development of branches that are ultimately
pushed into Subversion.  As a result, we end up with some interesting
situations (although not that much different in Bazaar, but we'd
approach the problem a little differently if Subversion was not
involved at all).

In this particular case, we had a branch, and some of the changes were
pulled from our branch into trunk.  We periodically merge trunk, so we
ended up with a conflict (since the file appeared new on trunk, it had
a new file id).  What they put in was exactly what we had, so the dev
kept our changes (which was probably a mistake... we should've
probably kept their version so that we would end up with the right
file ids, although I think we would have encountered similar conflicts
on our local branches).

Well, later, both sides ended up modifying the file.  We ended up with
a conflict that left our tree looking like this:

branch2:
file.txt
foo/
  bar.txt.BASE
  bar.txt.OTHER
foo.moved/
  bar.txt

What's confusing here is that it appears Bazaar tried to merge
bar.txt, but the conflicted files are in foo.  However, the original
file is in foo.moved.  And, bzr st says:

added:
  foo/
  foo/bar.txt.OTHER
renamed:
  foo/ => foo.moved/
unknown:
  branch1-nofoo/
  branch2-nofoo/
  foo/bar.txt.BASE
conflicts:
  Conflict adding files to foo.  Created directory.
  Conflict because foo is not versioned, but has versioned children.
Versioned directory.
  Conflict adding file foo.  Moved existing file to foo.moved.
  Contents conflict in foo/bar.txt
pending merge tips: (use -v to see all merge revisions)
  John Szakmeister 2010-08-14 Add more baz to my bar.

We see in the status output that there is a contents conflict in
foo/bar.txt, but it's missing from the file system (probably because
it's really living at foo.moved/bar.txt?).  I'm not sure Bazaar's
behavior is quite right here.  I realize it seems kind of edgy, but
I'd really like to understand how Bazaar is supposed to handle this
situation (and I'm not sure there is a great answer).  I would have
expected foo/bar.txt to exist, especially if Bazaar was trying to
merge the contents (if it wasn't supposed to merge the contents, then
I believe it should have produced a duplicate entry conflict instead).

I'm attaching a script to help produce the situation.  It creates
branch1 and branch2, and leaves branch2 with the final merge and this
goofy conflict situation.  I also created a branch1-nofoo and
branch2-nofoo that does almost the same steps, except without an
intermediate directory.  With the intermediate directory, you get
exactly the problem I described above.  Without the intermediate
directory, the conflict files end up where you expect them.

Keep in mind, my script is a bit contrived because I'm in a foreign
repository situation, but I wanted to reproduce this without
introducing Subversion into the picture (I didn't figure it was all
that friendly to the devs).

Thanks in advance!

-John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: repro.sh
Type: application/x-sh
Size: 1393 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20100814/499a4206/attachment.sh 


More information about the bazaar mailing list