Create merge request when editing on web UI v3 [can be updated]
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:
-
https://github.com/gitlabhq/gitlabhq/pull/8053/files (fixes the only CI failure) -
https://github.com/gitlabhq/gitlabhq/pull/8257
Dependencies already included here which were extracted from this PR and should be evaluated separately and merged first:
-
https://github.com/gitlabhq/gitlabhq/pull/8128 -
https://github.com/gitlabhq/gitlabhq/pull/8131 -
https://github.com/gitlabhq/gitlabhq/pull/8183
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:
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
toroot
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:
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
:
User does not have push permission, he must fork. "Create merge request" and "On my fork" are checked and disabled:
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:
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:
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