Re: Automatic 3 way merge for conflicts



Seems I didn't send a previous email to the list (oops), but my current thoughts below.

Firstly, bug report up:
https://bugzilla.gnome.org/show_bug.cgi?id=690469

In other words, if our MERGED file has diff3 conflict markers (rather
than the more common two-way conflict markers), we can reasonably
strip out the LOCAL and REMOTE parts of the conflict, which would
reliably leave the portion derived from BASE. There's no need to
actually consult BASE ourselves, or to make decisions about which
chunk to use. We just need to be able to get a diff3 formatted
conflict from the VC.

It doesn't look straight foward to get diff3 output from git without changing config options
It is possible in bzr and svn
Although to be honest, even if we have diff3 output, I don't really see the point in stripping out the LOCAL / REMOTE bits, as that would make the conflict markers invalid and the VCS might get confused if you (accidentally) save the resulting file and try to resolve the conflict in the VCS.

The conflicts will ALWAYS have to be resolved manually, and will ALWAYS mean changing the base anyway. Stripping out the REMOTE / LOCAL bits would not make conflict resolution quicker. 
Adding BASE in (where it doesn't exist, if user specifically requests it) *does* seem to make resolving things quicker.

To me this means what Kai suggested:
Now, having said that, in any situation where we have BASE but not
MERGED for some reason, I think it would be *awesome* to have a
GtkInfoBar-style (MsgArea in Meld) prompt asking whether the user
would like to start an auto-merge.

I think this bar prompt could be displayed even if we *don't* have merged.
Show MERGED, but have the bar prompt to do a 're-merge' using auto-merge if you want.
This would mean that even if the VCS isn't configured for (or doesn't support) diff3 output, we still have a way of showing the BASE.

Fair enough. BTW, it would be awesome to see a way to run this new mode from
command line so that it can be used with git mergetool etc.
Something like:
meld LOCAL BASE REMOTE --output=MERGED --output_is_already_merged_switch
or
meld LOCAL MERGED REMOTE --base=BASE
And then:
1) show regular 3-way diff if MERGED contains no conflict markers
2) alter MERGED content and show 3-way diff if MERGED contains diff3
markers (maybe, but not necessarily, offer switching to auto-merge)
3) show regular 3-way diff if MERGED contains non-diff3 conflict
markers and offer switching to auto-merge

I think doing the above should have the same effect as above - Show MERGED, but have the bar prompt to do a 're-merge' using auto-merge if you want.
I like the second command line version better.

Finally,
I'm actually going on holiday for a month on the 28th and won't get much time to work on this further until I get back.
If someone else wants to take what I've done and add the MsgArea prompt feel welcome. Otherwise it might have to wait. I've still found the patches I submitted to be helpful in my own working environment as is though :)

Cheers,
--
Louis.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]