diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-12 22:49:45 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-12 22:49:45 +0400 |
commit | 98416ec9ab805b0afb994972e073b743b8204312 (patch) | |
tree | 38c2b5f33fdb255d480de379215e91b80f9d35e3 /app | |
parent | c827af21d3548f98c809550b471bbb3f5a344076 (diff) |
Show proper message for new MR when satellite fails
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 12 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_new_compare.html.haml | 29 |
2 files changed, 27 insertions, 14 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 6ab353d2221..e15e1be2c6d 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -74,9 +74,17 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.source_branch ) + @compare_failed = false @commits = compare_action.commits - @commits.map! { |commit| Commit.new(commit) } - @commit = @commits.first + + if @commits + @commits.map! { |commit| Commit.new(commit) } + @commit = @commits.first + else + # false value because failed to get commits from satellite + @commits = [] + @compare_failed = true + end @diffs = compare_action.diffs @merge_request.title = @merge_request.source_branch.titleize.humanize diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index a8b774a3cd1..f8f14a71a11 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -33,18 +33,23 @@ %div= msg - if @merge_request.source_branch.present? && @merge_request.target_branch.present? - .light-well - %center - %h4 - There isn't anything to merge. - %p.slead - - if @merge_request.source_branch == @merge_request.target_branch - You'll need to use different branch names to get a valid comparison. - - else - %span.label-branch #{@merge_request.source_branch} - and - %span.label-branch #{@merge_request.target_branch} - are the same. + - if @compare_failed + .alert.alert-danger + %h4 Compare failed + %p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches. + - else + .light-well + %center + %h4 + There isn't anything to merge. + %p.slead + - if @merge_request.source_branch == @merge_request.target_branch + You'll need to use different branch names to get a valid comparison. + - else + %span.label-branch #{@merge_request.source_branch} + and + %span.label-branch #{@merge_request.target_branch} + are the same. %hr |