[PATCH 2 of 2] simplemerge: Display "base" in case of conflict

Mads Kiilerich mads at kiilerich.com
Thu Sep 27 06:49:43 CDT 2012

On 09/27/2012 12:06 PM, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1348740176 -7200
> # Node ID ce8ea3bbea8d818067750c06ebcf89f4c7471ddf
> # Parent  ac1131f2927400cb0e031d6929cfa3ce07cf1a27
> simplemerge: Display "base" in case of conflict
> This changeset enables a feature already present in `simplemerge;py`: Displaying
> common-base content during merges. For this purpose we have to disable an unused
> function of simple merge.

It would probably be better to do this part first in a separate change.

But IIRC simplemerge.py has a lot of cruft that only is used by 
contrib/simplemerge. It would perhaps be better to drop that from 
contrib remove the cruft.

> Adding the base revision to merge conflict help a lot to understand the source
> of a conflict. Being able to compare each side of the merge with the original
> code allows to understand the changes introduced by each branches to create a
> valid merge.
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -208,12 +208,13 @@ def _imerge(repo, mynode, orig, fcd, fco
>       if r:
>           a, b, c, back = files
>           ui = repo.ui
>           label = ['local: %s' % fcd.changectx(),
> -                 'other: %s' % fco.changectx()]
> -        r = simplemerge.simplemerge(ui, a, b, c, label=label)
> +                 'other: %s' % fco.changectx(),
> +                 'base: %s'  % fca.changectx()]
> +        r = simplemerge.simplemerge(ui, a, b, c, label=label, no_minimal=True)

no_minimal=True is a big and unacceptable change. It will cause a 
different and confusingly complex markup in the case where almost the 
same change has been done in both branches. (I suggest extending 
test-conflict.t to cover that case.)

I suggest introducing a [merge-tools] internal:merge.showbase boolean 
setting for enabling this new behaviour.


More information about the Mercurial-devel mailing list