Skip to content
Snippets Groups Projects

[WIP] Add option to create merge request when editing/creating a file

Fixes #3059 (closed). This PR adds an option to create a merge request directly after creating/updating a file ("blob"). If the user changes the name of the branch, a new option is shown.

One thing in particular remains to be done:

  • On the new MR, target branch should be set to the branch the user was originally on instead of using always 'master'.

A few improvements that could be done (maybe in separate issues):

  • Reduce code duplication in the blobs views.
  • Add controller tests for creating/editing blobs.
  • Add service tests for Files::CreateService.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
343 344 def git_import_enabled?
344 345 current_application_settings.import_sources.include?('git')
345 346 end
347
348 # new merge requests routing helpers
349 def new_mr_path_from_push_event(event, target_branch=nil)
  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 27 27 if result[:status] == :success
    28 28 flash[:notice] = "The changes have been successfully committed"
    29 29 respond_to do |format|
    30 format.html { redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) }
    30 format.html do
    31 url = if params[:create_merge_request]
    32 new_mr_path_from_push_event(current_user.recent_push(@project.id), @ref)
    • Do we need to use this method and use the last push, or can we just create the right URL based on @source_branch, @target_branch etc which we have access to here?

  • Douwe Maan mentioned in merge request !1820 (merged)

    mentioned in merge request !1820 (merged)

  • @dirceu Thanks again for your work! I created !1820 (merged) based on this MR with a little bit of added functionality.

  • Douwe Maan Status changed to closed

    Status changed to closed

  • Robert Speicher mentioned in commit 3a85c93a

    mentioned in commit 3a85c93a

  • Robert Speicher mentioned in commit 463a3cfe

    mentioned in commit 463a3cfe

  • Please register or sign in to reply
    Loading