improve merge algorithm for additional lines
Automatic merge fails in the following situation:
For a particular source code line on separate branches:
1) add a new line before or after it
2) modify the line
When rebasing one of the branches from the other this fails, apparently because the new line is grouped with the other in the diff tool. If they were considered separately it should be a trivial automatic merge.
An alternative would be to make the manual resolution easier by providing a mechanism to split the merge block so each line can be selected separately (source/base/dest). I think xxdiff has this capability. Currently you have to select 2 revisions and edit the text in the bottom window.
Done! Check this new feature with the new Plastic SCM 6.0.16.139 release: https://www.plasticscm.com/download/6.0.16.1395
-
Borja commented
Set an option for all files in a merge seems problematic. There are 2 different options to do it.
* The automatic resolution could apply this option. On this case the automatic result could be wrong, as I comment on the previous post.
* The option could be applied on the manual resolution, so the user will see the conflicts taking into account this option. As a result, mergetool could show all conflicts as automatic and the user could not understand why the manual resolution is required (why the mergetol is shown)
Create a shortcut for the option seems a good idea.
Anyway we will study all the possibilities. Thanks for the suggestions
-
robl commented
“split conflict blocks” sounds like it will help. It would be nice to be able to set merge options for all files in a merge, or perhaps create keyboard shortcuts to make it easier with many files.
Would it be sensible to automatically split these particular conflict blocks in this situation?
-
Borja commented
Hi,
The first alternative is not possible because it could leave an inconsistent automatic result. An added line can be automatically added only when the context (the lines in between it is added) is not changed by the other contributor, because if the context was changed the added line may no longer be valid. A manual conflict is better than a potentially wrong automatic result that could be difficult to detect.
The second alternative is a good possibility. Indeed it is already available a similar option on the “options” menu (“split conflict blocks”). This option separates the added lines to a different block when the context of the added lines is only changed by the other contributor. If the contributor which adds the lines also modifies the context, the conflict will not be separated in order to preserve the consistency.
But unfortunately this option is not working properly when only one line is changed. So it’s not working on the described situation, but it is working when:
* Modify or delete 2 or more lines.
* Add one or more lines before or after the modified/deleted lines.
We will fix the issue with a single line as soon as possible.
Could be the existing option (“split conflict blocks”) suitable to fix your situation?