Commit 98416ec9ab805b0afb994972e073b743b8204312
1 parent
c827af21
Exists in
spb-stable
and in
2 other branches
Show proper message for new MR when satellite fails
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
27 additions
and
14 deletions
Show diff stats
app/controllers/projects/merge_requests_controller.rb
| ... | ... | @@ -74,9 +74,17 @@ class Projects::MergeRequestsController < Projects::ApplicationController |
| 74 | 74 | @merge_request.source_branch |
| 75 | 75 | ) |
| 76 | 76 | |
| 77 | + @compare_failed = false | |
| 77 | 78 | @commits = compare_action.commits |
| 78 | - @commits.map! { |commit| Commit.new(commit) } | |
| 79 | - @commit = @commits.first | |
| 79 | + | |
| 80 | + if @commits | |
| 81 | + @commits.map! { |commit| Commit.new(commit) } | |
| 82 | + @commit = @commits.first | |
| 83 | + else | |
| 84 | + # false value because failed to get commits from satellite | |
| 85 | + @commits = [] | |
| 86 | + @compare_failed = true | |
| 87 | + end | |
| 80 | 88 | |
| 81 | 89 | @diffs = compare_action.diffs |
| 82 | 90 | @merge_request.title = @merge_request.source_branch.titleize.humanize | ... | ... |
app/views/projects/merge_requests/_new_compare.html.haml
| ... | ... | @@ -33,18 +33,23 @@ |
| 33 | 33 | %div= msg |
| 34 | 34 | |
| 35 | 35 | - if @merge_request.source_branch.present? && @merge_request.target_branch.present? |
| 36 | - .light-well | |
| 37 | - %center | |
| 38 | - %h4 | |
| 39 | - There isn't anything to merge. | |
| 40 | - %p.slead | |
| 41 | - - if @merge_request.source_branch == @merge_request.target_branch | |
| 42 | - You'll need to use different branch names to get a valid comparison. | |
| 43 | - - else | |
| 44 | - %span.label-branch #{@merge_request.source_branch} | |
| 45 | - and | |
| 46 | - %span.label-branch #{@merge_request.target_branch} | |
| 47 | - are the same. | |
| 36 | + - if @compare_failed | |
| 37 | + .alert.alert-danger | |
| 38 | + %h4 Compare failed | |
| 39 | + %p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches. | |
| 40 | + - else | |
| 41 | + .light-well | |
| 42 | + %center | |
| 43 | + %h4 | |
| 44 | + There isn't anything to merge. | |
| 45 | + %p.slead | |
| 46 | + - if @merge_request.source_branch == @merge_request.target_branch | |
| 47 | + You'll need to use different branch names to get a valid comparison. | |
| 48 | + - else | |
| 49 | + %span.label-branch #{@merge_request.source_branch} | |
| 50 | + and | |
| 51 | + %span.label-branch #{@merge_request.target_branch} | |
| 52 | + are the same. | |
| 48 | 53 | |
| 49 | 54 | |
| 50 | 55 | %hr | ... | ... |