Skip to content

Create merge request when editing on web UI v3 [can be updated]

Matthias Käppler requested to merge github/fork/cirosantilli/edit-mr-v14 into master

Created by: cirosantilli

Fixes: ACCEPTING MR at: http://feedback.gitlab.com/forums/176466-general/suggestions/5350102-option-to-make-a-merge-request-when-editing-via-we

Supersedes the original request: https://github.com/gitlabhq/gitlabhq/pull/7266

I proposed custom branch names to GitHub at: https://github.com/isaacs/github/issues/228 and they've half implemented it at: https://github.com/blog/1945-quick-pull-requests

Dependencies:

Dependencies already included here which were extracted from this PR and should be evaluated separately and merged first:

TODO on future PRs:

  • Allow to create new branch without creating a merge request (add new checkbox, implied by create mr)
  • When already on fork, add a "Create merge request back to origin checkbox"

TODO just before merging this after having evaluated:

  • set the gitlab-shell URL back to the original one

Blob edit page UI changes

If user has push permission on the current branch, when the page loads it looks like:

screenshot from 2014-11-02 17 12 20 initial

If user clicks on "Create merge request", he now sees:

  • the "On my fork" checkbox which shows where the merge request source will be
  • the source branch indicator master becomes an input so he can choose a custom branch name
  • the source repository changes from gitlab-org to root

screenshot from 2014-11-02 17 13 10 click create mr

By default, branch name is a free branch name on both repositories. When user toggles "On my fork", and he has not yet modified it, it toggles the branch name to a free branch name on given repo:

screenshot from 2014-11-02 17 32 43 on my fork

If user edits the branch name to a custom name like custom-name, the branch name toggle stops so as not to lose the user's input. So after editing the branch name and toggle "On my fork", the branch name stays at custom-name:

screenshot from 2014-11-02 17 34 40 custom name

User does not have push permission, he must fork. "Create merge request" and "On my fork" are checked and disabled:

screenshot from 2014-10-15 21 23 22 user does not have push permission on current branch

If user is already on his fork, he does not see "On my fork": the merge request will necessarily be generated between the current repo and itself:

screenshot from 2014-11-02 17 15 37 on fork

There is also a minor UI behavior change at blob#show: the edit button is enabled even if you don't have push permission since you can edit to start a merge request:

screenshot from 2014-10-15 21 45 23 blob show edit

Are there points in the code the reviewer needs to double check?

  • The hard thing of this MR was the testing. See the dependencies above and check them very well.
  • Permissions. Double check the controller specs, and the crux of the implementation: base_tree_controller.rb

Merge request reports

Loading