3-way conflict markers

Marijn hkBst at gentoo.org
Thu Oct 20 09:17:11 CDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear list,

recently I had to perform a non-trivial merge in a project at work
involving many conflicts. I investigated and tried a couple of
graphical merge tools and the built-in merge, but in the end my
conclusion was that the graphical tools often do too little or too
much and that for most conflicts the internal merge's conflict markers
would be ideal if only they were 3-way instead of 2-way. I'm actually
a bit surprised that the default for internal merge isn't 3-way
markers as 2-way markers just don't contain enough information to
decide who changed what (unless you have some other source of
information). (Next time you perform a non-trivial merge with one of
the graphical mergetools, try to ignore the base case or estimate what
percentage of conflicts you needed to look at the base case.)

Anyway, until 3-way conflict markers become the default for the
default internal mergetool, you can get them by setting up diff3 in
your .hgrc as follows:

[ui]
merge = diff3

[merge-tools]
#
# NB !!! THE ORDER OF FILE ARGUMENTS TO diff3 IS IMPORTANT !!!
#
diff3.args = -mA -L local -L base -L other -- $local $base $other >
$output

^^^ no line-break in that last line...

Some alternative options for louder conflict markers that I toyed with
are:
#diff3.args = -mA -L LOCAL -L BASE -L OTHER -- $local $base $other >
$output
#diff3.args = -mA -L '*LOCAL* <<<<<<<' -L '*BASE* <|<|<|<' -L '*OTHER*
>>>>>>> ' -- $local $base $other > $output

You get the idea,

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6gLWcACgkQp/VmCx0OL2zM/wCcDotFHX/ohkutFmfdXRG0ecT1
6pIAnjCkxOnBa9HSB3N1KDVQF0py7wHD
=Euwn
-----END PGP SIGNATURE-----


More information about the Mercurial-devel mailing list