gitlab-org--gitlab-foss/app/views/projects/merge_requests
Douwe Maan d43c778402 Merge branch 'indicate-mr-diverged-from-target' into 'master'
Indicate when an MR diverged from the target branch

This adds an indicator to the "Merge MR" box, to tell if and how much an MR diverged from its target branch.

For instance, consider an MR to merge the branch `feature` into `master`. Some other commits were added to `master` since `feature` was created, and the two branches diverged.

```text
o master
|
o    o feature
|    |
o    o
|  /
o
```

In this case, there will be a label in the MR Merge box stating:

> This MR is by 3 commits behind the target branch `master`.

## Screenshots

### The branch diverged from the target (UI Proposal)

![UI_suggestion_1](/uploads/cd5bee3959e68026ec7d5097259d53f4/UI_suggestion_1.png)

### The branch diverged from the target (alternative UI Proposal)

![UI_suggestion_2](/uploads/f36977101b59a610850e129837dfbc83/UI_suggestion_2.png)

## How is this useful?

- In a _rebase-workflow_ (MR are preferably rebased before being merged), the reviewer wants to know if an MR is rebased on the target branch before merging it. 
    
    _With this indicator, the reviewer knows immediately if the branch is rebased, or if she needs to ask the committer to rebase its branch._

<br>

- To keep the git history readable, a team prefers to avoid merging branches that really lag a lot behind the target branch. Merging an MR that is 10 commits behind is fine, but 200 is too much.

    _With this indicator, the reviewer can see on the MR page if the branch is really far behind the target – or only a few commits behind._

## Open questions

We've been using this at @captaintrain for a few months now, and found it quite useful.

I guess the open-questions are mostly: what UI would be the more adequate? Any thoughts on this, on the general usefulness and/or on the code?

See merge request !2217
2016-03-07 09:01:26 +00:00
..
show Fixes style consistencies. 2016-03-04 13:24:24 -05:00
widget Change js-quick-submit behavior to expect the class on the form 2016-03-02 15:11:15 -05:00
_discussion.html.haml gets merge request discussion working again 2016-01-12 16:29:14 -05:00
_form.html.haml Remove unnecesary wrapper elements 2015-12-02 14:41:56 +01:00
_head.html.haml
_header_title.html.haml Move project header title definition to view in question. 2015-09-17 12:16:24 +02:00
_merge_request.html.haml Removed un-used variables 2016-03-01 13:03:39 +00:00
_merge_requests.html.haml Implement new UI for pagination 2016-01-20 21:27:01 -05:00
_new_compare.html.haml Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
_new_submit.html.haml Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
_show.html.haml Merge branch 'indicate-mr-diverged-from-target' into 'master' 2016-03-07 09:01:26 +00:00
branch_from.js.haml Time ago fix for compare page 2015-07-15 16:59:31 +03:00
branch_to.js.haml Time ago fix for compare page 2015-07-15 16:59:31 +03:00
cancel_merge_when_build_succeeds.js.haml Merge when build succeeds 2015-11-02 17:27:38 +01:00
diffs.html.haml
edit.html.haml Use consistent casing for page titles 2015-12-02 14:41:54 +01:00
index.html.haml Re-use top-are css component for issues/mr pages 2016-02-05 11:35:55 +01:00
invalid.html.haml Move project header title definition to view in question. 2015-09-17 12:16:24 +02:00
merge.js.haml Merge branch 'master' into merge-if-green 2015-12-07 10:06:07 +01:00
new.html.haml Don't reset target branch when choosing to "Change branches" in MR 2015-12-02 14:23:13 +01:00
show.html.haml
update.js.haml Fix a bug preventing from doing subsequent edits in any Issuable sidebar 2016-02-17 10:17:57 +01:00
update_branches.js.haml