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

Pierre-Yves David pierre-yves.david at logilab.fr
Tue Oct 2 12:32:53 CDT 2012

On Thu, Sep 27, 2012 at 01:49:43PM +0200, Mads Kiilerich wrote:
> 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.

Missing word here. Do you suggest to just drop the feature completly ?

> >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.

no_minimal=False only enables simple merge to detect "manually solved
conflict". See the `reprocess_merge_regions` function in
`mercurial.simplemerge`. it's doc is:

    """Where there are conflict regions, remove the agreed lines.

    Lines where both A and B have made the same changes are

This is **never** useful here as the unchanged file from A and B are extracted
from mercurial before any call to simple merge.

> 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.)

Are you arguing about adding the base ? It' more often useful to me that
detrimental. Several user have complained that "you do not know the base while
merging with marker. I think it's a net win.

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

Pierre-Yves David


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121002/296b61f3/attachment.pgp>

More information about the Mercurial-devel mailing list