Handling big commits & big diff
This commit is contained in:
parent
17a88bb6a2
commit
86676476e6
|
@ -74,3 +74,8 @@ function resetMenu() {
|
||||||
function slugify(text) {
|
function slugify(text) {
|
||||||
return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase();
|
return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showDiff(link) {
|
||||||
|
$(link).next('table').show();
|
||||||
|
$(link).remove();
|
||||||
|
}
|
||||||
|
|
|
@ -17,9 +17,15 @@ a {
|
||||||
&.lined {
|
&.lined {
|
||||||
text-decoration:underlined;
|
text-decoration:underlined;
|
||||||
}
|
}
|
||||||
|
&.supp_diff_link {
|
||||||
|
text-align:center;
|
||||||
|
padding:20px 0;
|
||||||
|
background:#f1f1f1;
|
||||||
|
width:100%;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f1f1f1), color-stop(25%, #f1f1f1), to(#e6e6e6));
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f1f1f1), color-stop(25%, #f1f1f1), to(#e6e6e6));
|
||||||
background-image: -webkit-linear-gradient(#f1f1f1, #f1f1f1 25%, #e6e6e6);
|
background-image: -webkit-linear-gradient(#f1f1f1, #f1f1f1 25%, #e6e6e6);
|
||||||
|
|
|
@ -34,6 +34,10 @@ class CommitsController < ApplicationController
|
||||||
@line_notes = project.commit_line_notes(@commit)
|
@line_notes = project.commit_line_notes(@commit)
|
||||||
|
|
||||||
@notes_count = @line_notes.count + project.commit_notes(@commit).count
|
@notes_count = @line_notes.count + project.commit_notes(@commit).count
|
||||||
|
|
||||||
|
if @commit.diffs.size > 200 && !params[:force_show_diff]
|
||||||
|
@suppress_diff = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def compare
|
def compare
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
|
- if @suppress_diff
|
||||||
|
.alert-message.block-message
|
||||||
|
%p
|
||||||
|
%strong Warning! Large commit with more then 200 files changed.
|
||||||
|
%p To prevent performance issue we rejected diff information.
|
||||||
|
%p
|
||||||
|
But if you still want to see diff
|
||||||
|
= link_to "click this link", project_commit_path(@project, @commit.id, :force_show_diff => true), :class => "dark"
|
||||||
|
|
||||||
|
|
||||||
|
%p.cgray
|
||||||
|
Showing #{pluralize(diffs.count, "changed file")}
|
||||||
.file_stats
|
.file_stats
|
||||||
= render "commits/diff_head", :diffs => diffs
|
= render "commits/diff_head", :diffs => diffs
|
||||||
|
|
||||||
- diffs.each_with_index do |diff, i|
|
|
||||||
|
- unless @suppress_diff
|
||||||
|
- diffs.each_with_index do |diff, i|
|
||||||
- next if diff.diff.empty?
|
- next if diff.diff.empty?
|
||||||
- file = (@commit.tree / diff.b_path)
|
- file = (@commit.tree / diff.b_path)
|
||||||
- file = (@commit.prev_commit.tree / diff.a_path) unless file
|
- file = (@commit.prev_commit.tree / diff.a_path) unless file
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
%table
|
- too_big = max_lines = diff.diff.lines.count > 1000
|
||||||
|
- if too_big
|
||||||
|
= link_to_function "Diff suppressed. Click to show", "showDiff(this)", :class => "supp_diff_link"
|
||||||
|
|
||||||
|
%table{:class => "#{'hide' if too_big}"}
|
||||||
- each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old|
|
- each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old|
|
||||||
%tr.line_holder
|
%tr.line_holder
|
||||||
- if type == "match"
|
- if type == "match"
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
%pre.commit_message
|
%pre.commit_message
|
||||||
= commit_msg_with_link_to_issues(@project, @commit.safe_message)
|
= commit_msg_with_link_to_issues(@project, @commit.safe_message)
|
||||||
%br
|
%br
|
||||||
%p.cgray
|
|
||||||
Showing #{pluralize(@commit.diffs.count, "changed file")}
|
|
||||||
= render "commits/diffs", :diffs => @commit.diffs
|
= render "commits/diffs", :diffs => @commit.diffs
|
||||||
= render "notes/notes", :tid => @commit.id, :tt => "commit"
|
= render "notes/notes", :tid => @commit.id, :tt => "commit"
|
||||||
= render "notes/per_line_form"
|
= render "notes/per_line_form"
|
||||||
|
|
43
db/schema.rb
43
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20120323221339) do
|
ActiveRecord::Schema.define(:version => 20120405211750) do
|
||||||
|
|
||||||
create_table "events", :force => true do |t|
|
create_table "events", :force => true do |t|
|
||||||
t.string "target_type"
|
t.string "target_type"
|
||||||
|
@ -30,8 +30,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.integer "assignee_id"
|
t.integer "assignee_id"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "closed", :default => false, :null => false
|
t.boolean "closed", :default => false, :null => false
|
||||||
t.integer "position", :default => 0
|
t.integer "position", :default => 0
|
||||||
t.boolean "critical", :default => false, :null => false
|
t.boolean "critical", :default => false, :null => false
|
||||||
|
@ -43,8 +43,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
|
|
||||||
create_table "keys", :force => true do |t|
|
create_table "keys", :force => true do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.text "key"
|
t.text "key"
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.string "identifier"
|
t.string "identifier"
|
||||||
|
@ -59,11 +59,12 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.integer "assignee_id"
|
t.integer "assignee_id"
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.boolean "closed", :default => false, :null => false
|
t.boolean "closed", :default => false, :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.text "st_commits"
|
t.text "st_commits", :limit => 2147483647
|
||||||
t.text "st_diffs"
|
t.text "st_diffs", :limit => 2147483647
|
||||||
t.boolean "merged", :default => false, :null => false
|
t.boolean "merged", :default => false, :null => false
|
||||||
|
t.boolean "auto_merge", :default => true, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id"
|
add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id"
|
||||||
|
@ -73,8 +74,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.string "noteable_id"
|
t.string "noteable_id"
|
||||||
t.string "noteable_type"
|
t.string "noteable_type"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.string "attachment"
|
t.string "attachment"
|
||||||
t.string "line_code"
|
t.string "line_code"
|
||||||
|
@ -87,8 +88,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "path"
|
t.string "path"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "private_flag", :default => true, :null => false
|
t.boolean "private_flag", :default => true, :null => false
|
||||||
t.string "code"
|
t.string "code"
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
|
@ -111,8 +112,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.text "content"
|
t.text "content"
|
||||||
t.integer "author_id", :null => false
|
t.integer "author_id", :null => false
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "file_name"
|
t.string "file_name"
|
||||||
t.datetime "expires_at"
|
t.datetime "expires_at"
|
||||||
end
|
end
|
||||||
|
@ -145,8 +146,8 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
t.datetime "last_sign_in_at"
|
t.datetime "last_sign_in_at"
|
||||||
t.string "current_sign_in_ip"
|
t.string "current_sign_in_ip"
|
||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.boolean "admin", :default => false, :null => false
|
t.boolean "admin", :default => false, :null => false
|
||||||
t.integer "projects_limit", :default => 10
|
t.integer "projects_limit", :default => 10
|
||||||
|
@ -165,16 +166,16 @@ ActiveRecord::Schema.define(:version => 20120323221339) do
|
||||||
create_table "users_projects", :force => true do |t|
|
create_table "users_projects", :force => true do |t|
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "project_access", :default => 0, :null => false
|
t.integer "project_access", :default => 0, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "web_hooks", :force => true do |t|
|
create_table "web_hooks", :force => true do |t|
|
||||||
t.string "url"
|
t.string "url"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "wikis", :force => true do |t|
|
create_table "wikis", :force => true do |t|
|
||||||
|
|
Loading…
Reference in a new issue