Skip to content

Commit

Permalink
Cache MR diffs result. Improve diff output
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Jul 8, 2013
1 parent 967d42e commit 63e532e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion app/controllers/projects/merge_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def show
end

def diffs
@diffs = @merge_request.diffs
@commit = @merge_request.last_commit

@comments_allowed = @reply_allowed = true
Expand Down
4 changes: 3 additions & 1 deletion app/models/merge_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def check_if_can_be_merged
end

def diffs
load_diffs(st_diffs) || []
@diffs ||= (load_diffs(st_diffs) || [])
end

def reloaded_diffs
Expand All @@ -128,6 +128,8 @@ def reloaded_diffs

def broken_diffs?
diffs == broken_diffs
rescue
true
end

def valid_diffs?
Expand Down
3 changes: 2 additions & 1 deletion app/views/projects/merge_requests/_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/merge_requests/show/_diffs.html.haml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions doc/install/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,19 @@ 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
sudo -u git -H git config --global user.name "GitLab"
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

Expand Down

0 comments on commit 63e532e

Please sign in to comment.