BigW Consortium Gitlab

_how_to_merge.html.haml 2.46 KB
Newer Older
1
%div#modal_merge_info.modal
Dmitriy Zaporozhets committed
2 3 4 5
  .modal-dialog
    .modal-content
      .modal-header
        %a.close{href: "#", "data-dismiss" => "modal"} ×
6
        %h3 Check out, review, and merge locally
Dmitriy Zaporozhets committed
7
      .modal-body
8
        %p
9
          %strong Step 1.
10
          Fetch and check out the branch for this merge request
11
        = clipboard_button(clipboard_target: "pre#merge-info-1")
12
        %pre.dark#merge-info-1
13
          - if @merge_request.for_fork?
Dmitriy Zaporozhets committed
14
            :preserve
15
              git fetch #{h default_url_to_repo(@merge_request.source_project)} #{h @merge_request.source_branch}
16
              git checkout -b #{h @merge_request.source_project_path}-#{h @merge_request.source_branch} FETCH_HEAD
17
          - else
18 19
            :preserve
              git fetch origin
20
              git checkout -b #{h @merge_request.source_branch} origin/#{h @merge_request.source_branch}
21 22 23 24 25 26 27
        %p
          %strong Step 2.
          Review the changes locally

        %p
          %strong Step 3.
          Merge the branch and fix any conflicts that come up
28
        = clipboard_button(clipboard_target: "pre#merge-info-3")
29
        %pre.dark#merge-info-3
30 31
          - if @merge_request.for_fork?
            :preserve
32 33
              git checkout #{h @merge_request.target_branch}
              git merge --no-ff #{h @merge_request.source_project_path}-#{h @merge_request.source_branch}
34
          - else
Dmitriy Zaporozhets committed
35
            :preserve
36 37
              git checkout #{h @merge_request.target_branch}
              git merge --no-ff #{h @merge_request.source_branch}
38 39 40
        %p
          %strong Step 4.
          Push the result of the merge to GitLab
41
        = clipboard_button(clipboard_target: "pre#merge-info-4")
42
        %pre.dark#merge-info-4
43
          :preserve
44
            git push origin #{h @merge_request.target_branch}
45 46 47
        - unless @merge_request.can_be_merged_by?(current_user)
          %p
            Note that pushing to GitLab requires write access to this repository.
48 49
        %p
          %strong Tip:
50 51 52
          = succeed '.' do
            You can also checkout merge requests locally by
            = link_to 'following these guidelines', help_page_path('user/project/merge_requests.md', anchor: "checkout-merge-requests-locally"), target: '_blank'
53 54 55 56 57 58 59 60

:javascript
  $(function(){
    var modal = $('#modal_merge_info').modal({modal: true, show:false});
    $('.how_to_merge_link').bind("click", function(){
      modal.show();
    });
    $('.modal-header .close').bind("click", function(){
61
      modal.hide();
62 63
    })
  })