Create a patch from the Web IDE
Description
As a MR reviewer, I often send patches in MR reviews.
It would be amazing if I could use the Web IDE to do this. That way I wouldn't have to stash my local changes and checkout a new branch.
Consider that the suggest changes feature comes pretty close to the way patches are used in today's MR reviews (i.e. A reviewer wants to provide a changeset for discussion without committing anything). But patches have the potential to be way more usable than creating suggestions. Currently, if I want to suggest renaming something that's referenced 9 times, I have to create 9 separate
suggestion
comments. With patches, I can just create 1 comment for 1 cohesive change. We're just missing the ability to review/apply.patch
files or inline patches (which should be very doable since this is pretty close to how individual suggestions work).
Proposal
Introduce a new button to create a patch from the changes from the "Changes" tab of the WebIDE.
Changes tab with patch button | Viewing a patch |
---|---|
![]() |
![]() |
- Add icon button for "Create patch from changes"
- Icon: doc-changes
- Tooltip: "Create patch from changes"
- Clicking on the create patch button, opens the changes as a patch file on the righthand side of the WebIDE
- File type icon: git
- File name:
{commit id}-{current branch}.patch
- While viewing the patch file, two buttons will be visible
- Download patch
- Icon: Download
- Tooltip: "Download patch"
- Copy patch to clipboard
- Icon: copy-to-clipboard
- Tooltip: "Copy patch to clipboard"
- Download patch
Every time the user clicks on "Create patch from changes" a new patch is created. This is because while in the "Changes" tab you can still edit the files that are there so regenerating the patch would ensure the latest changes are included in the patch. This is also why we don't need to have a "close" or "x" for the patch view.
The buttons for copying and downloading the patch are icons so that it has familiarity in how files are displayed in the repository and snippets with actions in the top right area.
Testing
New E2E test will be needed for the feature - scheduled in gitlab-org/quality/testcases#1846 (closed). Please also run package-and-qa
in MR for regression purposes.