Commit 63e532ef authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cache MR diffs result. Improve diff output

parent 967d42e0
web: bundle exec puma -p $PORT web: bundle exec unicorn_rails -p $PORT -E development
worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell
...@@ -30,7 +30,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -30,7 +30,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def diffs def diffs
@diffs = @merge_request.diffs
@commit = @merge_request.last_commit @commit = @merge_request.last_commit
@comments_allowed = @reply_allowed = true @comments_allowed = @reply_allowed = true
......
...@@ -116,7 +116,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -116,7 +116,7 @@ class MergeRequest < ActiveRecord::Base
end end
def diffs def diffs
load_diffs(st_diffs) || [] @diffs ||= (load_diffs(st_diffs) || [])
end end
def reloaded_diffs def reloaded_diffs
...@@ -128,6 +128,8 @@ class MergeRequest < ActiveRecord::Base ...@@ -128,6 +128,8 @@ class MergeRequest < ActiveRecord::Base
def broken_diffs? def broken_diffs?
diffs == broken_diffs diffs == broken_diffs
rescue
true
end end
def valid_diffs? def valid_diffs?
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
.notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" }
= render "projects/notes/notes_with_form" = render "projects/notes/notes_with_form"
.diffs.tab-content .diffs.tab-content
= render "projects/merge_requests/show/diffs" if @diffs - if current_page?(action: 'diffs')
= render "projects/merge_requests/show/diffs"
.status .status
:javascript :javascript
......
- if @merge_request.valid_diffs? - if @merge_request.valid_diffs?
= render "projects/commits/diffs", diffs: @diffs = render "projects/commits/diffs", diffs: @merge_request.diffs
- elsif @merge_request.broken_diffs? - elsif @merge_request.broken_diffs?
%h4.nothing_here_message %h4.nothing_here_message
Can't load diff. Can't load diff.
......
...@@ -184,11 +184,11 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version, ...@@ -184,11 +184,11 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version,
sudo chmod -R u+rwX public/uploads sudo chmod -R u+rwX public/uploads
# Copy the example Puma config # Copy the example Puma config
sudo -u git -H cp config/puma.rb.example config/puma.rb sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
# Enable cluster mode if you expect to have a high load instance # Enable cluster mode if you expect to have a high load instance
# Ex. change amount of workers to 3 for 2GB RAM server # Ex. change amount of workers to 3 for 2GB RAM server
sudo -u git -H vim config/puma.rb sudo -u git -H vim config/unicorn.rb
# Configure Git global settings for git user, useful when editing via web # Configure Git global settings for git user, useful when editing via web
# Edit user.email according to what is set in gitlab.yml # Edit user.email according to what is set in gitlab.yml
...@@ -196,7 +196,7 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version, ...@@ -196,7 +196,7 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version,
sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git -H git config --global user.email "gitlab@localhost"
**Important Note:** **Important Note:**
Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup. Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
## Configure GitLab DB settings ## Configure GitLab DB settings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment