Merge request: support commit-by-commit and commit-range reviews

Problem to solve

Merge Requests have a "Commits" tab, but switching between them is tedious (since there are no Prev/Next links and/or Hotkey similar to what GitHub has). The "Changes" tab does not offer a selection of either one or more commits (again, similar to what GitHub has) to do something like a commit-by-commit based review or to exclude certain commits from the current review (like already reviewed ones; or ones that are split into another MR but still included as dependency).

Intended users

Further details

No matter how small or large a MR is, many users (myself included) prefer to do a commit-by-commit review to

  1. witness the historical progression of how the branch (and in extension, the MR) came to be. This also comes with the benefit of showing the commit message, further extending on what the developer meant when they wrote the code/commit.
  2. get smaller chunks of changes at once to digest while still going through the full MR.
  3. see changes otherwise hidden by the full "Changes" tab (such as adding a line then removing it again).

Proposal

I'll be bold and just snag some inspiration from GitHub; they already have this as a feature and many developers I work with know/use it frequently: GitHub: changes from all commits

Note this is on the "Changes" tab; not the "Commits" tab.

Selecting any single commit switches to that particular commit, in the context of the MR itself (so comments/discussions made by anyone that apply to a file/change are visible, as well as the ability to create new comments/discussions that are then linked to the MR). This is pretty the equivalent (if not the same) of the already existing option by going to the "Commits" tab and picking any one of them.

To make moving between them easier, a set of "Next" and "Previous" links should be shown when working with a single commit selection. Clicking "Next" (or using a Hotkey) navigates to the next commit in ancestor order (or perhaps as option, in chronological order; which might not be the same as ancestor order); and clicking "Previous" (again, potentially using a Hotkey) navigates to the previous commit (or "Parent" in Git terms). This would make things a lot easier during a review, as the current UI requires a user to navigate back to the "Commits" tab, hopefully remember which commit they were just on, and then pick the next one (plus rinse and repeat for all remaining commits).

The same menu to select a single commit could also be used to select a commit range; in the above screenshot we might want to review all but the first commit (since the header/library upgrade is mainly noise but nothing reviewable in the broader sense). Selecting Commit 2 as start and Commit 4 as the end will show a view similar to the current "Changes" tab, except that it is limited to the selected range of commits (inclusive start, inclusive end). In this mode, providing "Next" and "Previous" links does not really make sense (because "Next"/"Previous" compared to what?); just like it has no real value when the whole range of commits is being shown all at once (the current behavior of the "Changes" tab).

Finally, to make it easier for the user to get back to the full view (for example, to see all per-commit comments/discussions in context of the full diff), the menu also has an option for the full range (without requiring the user to select the first commit as start and the last commit as end).

Bonus points: GitHub also has the "View changes since last review" feature described in #25559 which could fit nicely into this menu (if implemented in a similar way).

Permissions and Security

No additional permissions are required; other than the ones necessary to view and comment on a merge request.

Documentation

Testing

What does success look like, and how can we measure that?

What is the type of buyer?

Links / references