Add ability to cherry pick and make changes line-by-line in merge request
Problem to solve
Sometimes it is necessary to need line-by-line resolution in a file, even when no direct conflict exists. This is common when you have a fork of a project that diverges substantially from the original but contains important changes that must be merged back to the master.
Further details
Assume as an example there is a web server project with a single file containing a set of HTTP endpoints. This project is later forked and the fork begins to add all new endpoints and features not in the original. Over time this new project will contain many security fixes for the base project and it is desirable to merge these changes back to the original master. However, in doing so it is not desired to merge back the new functionality of the fork.
Currently when performing a merge request there is no ability to perform a proper 2-way or 3-way merge of the entire file, including automatically resolvable conflicts. The system automatically resolves conflicts but doesn't allow the option to choose which file version to merge in the final commit. Reviewers have the option to edit the file but this version only represents the target version of a file and does not contain any diff information needed to perform a proper merge. This forces the reviewer to check out the merge request locally to manually re-resolve the files in question without the help of a diff or merge tool. This process becomes error prone and tedious.
In other source control system such as Perforce, this is easily accomplished using the Resolve option for any file. Once the Resolve option is selected the user is presented with the choice to accept base, source or target wholesale for the entire file or launch the merge tool. When the merge tool is launched the reviewer has the ability to cherry pick line-by-line which version they desire and they can further make modifications to the file in-place without any complicated processes.
See Resolving Conflicts in P4V for an example https://youtu.be/OwXSiGz_xdw?t=88
Proposal
It should be possible to perform 2-way and 3-way merge resolution on a per-line basis in any file directly from the Changes view of the merge request, regardless of whether there is a direct line conflict or the changes can be automatically resolved. Further, it should be possible to make direct edits to the file without navigating to a separate page and without losing the context of the diff itself.
What does success look like, and how can we measure that?
For each modified line, either in the inline or side-by-side view, a menu option can be placed offering the choice of base, source or target. The reviewer can then select which version they desire and further click on the line to make any edit they choose. Completely replacing the line and even adding additional lines as desired. The changes can then be easily saved by clicking the Save button located at the top of the file next to the header. Should the reviewer click the Edit button they are presented with the fully merged version of the file, based on their selections in the previous page and including all additional modifications.
Links / references
Resolving Conflicts in P4V https://youtu.be/OwXSiGz_xdw?t=88