%h3.page-title
  New Merge Request
%p.slead
  - source_title, target_title = format_mr_branch_names(@merge_request)
  From
  %strong.label-branch #{source_title}
  %span into
  %strong.label-branch #{target_title}

  %span.pull-right
    = link_to 'Change branches', mr_change_branches_path(@merge_request)
%hr
= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: 'merge-request-form form-horizontal common-note-form js-requires-input' } do |f|
  = render 'shared/issuable/form', f: f, issuable: @merge_request
  = f.hidden_field :source_project_id
  = f.hidden_field :source_branch
  = f.hidden_field :target_project_id
  = f.hidden_field :target_branch

.mr-compare.merge-request
  %ul.merge-request-tabs.nav-links.no-top.no-bottom
    %li.commits-tab
      = link_to url_for(params), data: {target: 'div#commits', action: 'new', toggle: 'tab'} do
        Commits
        %span.badge= @commits.size
    - if @pipeline
      %li.builds-tab.active
        = link_to url_for(params), data: {target: 'div#builds', action: 'builds', toggle: 'tab'} do
          Builds
          %span.badge= @statuses.size
    %li.diffs-tab.active
      = link_to url_for(params), data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'} do
        Changes
        %span.badge= @diffs.real_size

  .tab-content
    #commits.commits.tab-pane
      = render "projects/merge_requests/show/commits"
    #diffs.diffs.tab-pane.active
      - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
        .alert.alert-danger
          %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
          %p To preserve performance the line changes are not shown.
      - else
        = render "projects/diffs/diffs", diffs: @diffs, show_whitespace_toggle: false
    - if @pipeline
      #builds.builds.tab-pane
        = render "projects/merge_requests/show/builds"

:javascript
  $('.assign-to-me-link').on('click', function(e){
    $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change");
    e.preventDefault();
  });
:javascript
  var merge_request = new MergeRequest({
    action: "#{(@show_changes_tab ? 'diffs' : 'new')}",
    setUrl: false
  });
