summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-08 20:12:35 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-08 20:12:35 +0300
commit63e532eff01ac927e7fa39781d9ebd61503c9a3e (patch)
treebc624a561827c3022be8787f26aae518a5ba3f58
parent967d42e0c8701c82d7d7494b1fd1d96cd4f2973f (diff)
downloadgitlab-ce-63e532eff01ac927e7fa39781d9ebd61503c9a3e.tar.gz
Cache MR diffs result. Improve diff output
-rw-r--r--Procfile2
-rw-r--r--app/controllers/projects/merge_requests_controller.rb1
-rw-r--r--app/models/merge_request.rb4
-rw-r--r--app/views/projects/merge_requests/_show.html.haml3
-rw-r--r--app/views/projects/merge_requests/show/_diffs.html.haml2
-rw-r--r--doc/install/installation.md6
6 files changed, 10 insertions, 8 deletions
diff --git a/Procfile b/Procfile
index fade88bd3a3..9003369c938 100644
--- a/Procfile
+++ b/Procfile
@@ -1,2 +1,2 @@
-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
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 0aa8bc8a6df..33c1a1feff7 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -30,7 +30,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def diffs
- @diffs = @merge_request.diffs
@commit = @merge_request.last_commit
@comments_allowed = @reply_allowed = true
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index c45af9f713e..2a476355404 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -116,7 +116,7 @@ class MergeRequest < ActiveRecord::Base
end
def diffs
- load_diffs(st_diffs) || []
+ @diffs ||= (load_diffs(st_diffs) || [])
end
def reloaded_diffs
@@ -128,6 +128,8 @@ class MergeRequest < ActiveRecord::Base
def broken_diffs?
diffs == broken_diffs
+ rescue
+ true
end
def valid_diffs?
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 987fb4bcc49..8df12644fa1 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -21,7 +21,8 @@
.notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" }
= render "projects/notes/notes_with_form"
.diffs.tab-content
- = render "projects/merge_requests/show/diffs" if @diffs
+ - if current_page?(action: 'diffs')
+ = render "projects/merge_requests/show/diffs"
.status
:javascript
diff --git a/app/views/projects/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml
index 1d52e824fad..3c1d14572aa 100644
--- a/app/views/projects/merge_requests/show/_diffs.html.haml
+++ b/app/views/projects/merge_requests/show/_diffs.html.haml
@@ -1,5 +1,5 @@
- if @merge_request.valid_diffs?
- = render "projects/commits/diffs", diffs: @diffs
+ = render "projects/commits/diffs", diffs: @merge_request.diffs
- elsif @merge_request.broken_diffs?
%h4.nothing_here_message
Can't load diff.
diff --git a/doc/install/installation.md b/doc/install/installation.md
index 09b09c2aa45..9200d597259 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -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
# 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
# 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
# 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,
sudo -u git -H git config --global user.email "gitlab@localhost"
**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