Bad base selection / three-way-text-merge issues
Aaron Bentley
aaron.bentley at utoronto.ca
Thu Oct 20 15:23:20 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley wrote:
> The merge base selection in bzr is usually pretty good, but here's an
> example of how it can go wrong:
> http://panoramicfeedback.com/opensource/bzr/wrong-base.svgz
Heh, maybe bzr knows best after all. You get different conflicts if you
force R1318. With the original base, you get a conflict in
bzrlib/transport/__init__. With R1318, you get a conflict in
bzrlib/merge.py
This is another case where diff3 gets fewer conflicts than merge3--
merge3 gets additional conflicts in bzrlib/config.py.
What's somewhat frustrating about even the diff3 output is that you get
many lines reported as conflicts that clearly are the same:
<<<<<<< TREE
base_rev_id = base_branch.get_rev_id(base_revision[1])
fetch(from_branch=base_branch, to_branch=this_branch)
base_is_ancestor = is_ancestor(this_rev_id, base_rev_id,
this_branch)
...
=======
base_rev_id = base_branch.get_rev_id(base_revision[1])
fetch(from_branch=base_branch, to_branch=this_branch)
base_is_ancestor = is_ancestor(this_rev_id, base_rev_id,
this_branch)
Algorithmically, I can understand why diff3 does this:
- - THIS and OTHER both differ from BASE, which starts a new comparision
section.
- - The point where THIS and OTHER start to agree with BASE is the end of
the comparison section.
- - In the comparison section, THIS, OTHER, and BASE have different texts.
Still, I think we would be better served by dividing the text into
smaller sections, such that:
- - The point where THIS and OTHER start to disagree with BASE begins a
section.
- - The point where THIS and OTHER start to disagree with each other as
well as BASE starts another section.
I guess what I really want from an algorithm is:
- - compare THIS and OTHER
- - where they disagree with one another, find the equivalent lines in BASE
- - do a three-way merge; if THIS matches BASE, OTHER wins, if OTHER
matches base, THIS wins, otherwise conflict.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDV6hY0F+nu1YWqI0RAgj0AJ9hfQYN2aQl2dSCpuvBw4lq+YaCswCdGOnZ
E+s5HE+iyuyl4+mIBdxKiOI=
=/RFK
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list