To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / fixtures / diffs / subversion.diff @ 441:cbce1fd3b1b7
History | View | Annotate | Download (2.68 KB)
| 1 |
Index: app/views/settings/_general.rhtml
|
|---|---|
| 2 |
===================================================================
|
| 3 |
--- app/views/settings/_general.rhtml (revision 2094)
|
| 4 |
+++ app/views/settings/_general.rhtml (working copy)
|
| 5 |
@@ -48,6 +48,9 @@
|
| 6 |
<p><label><%= l(:setting_feeds_limit) %></label> |
| 7 |
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p> |
| 8 |
|
| 9 |
+<p><label><%= l(:setting_diff_max_lines_displayed) %></label>
|
| 10 |
+<%= text_field_tag 'settings[diff_max_lines_displayed]', Setting.diff_max_lines_displayed, :size => 6 %></p>
|
| 11 |
+
|
| 12 |
<p><label><%= l(:setting_gravatar_enabled) %></label> |
| 13 |
<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p> |
| 14 |
</div>
|
| 15 |
Index: app/views/common/_diff.rhtml
|
| 16 |
===================================================================
|
| 17 |
--- app/views/common/_diff.rhtml (revision 2111)
|
| 18 |
+++ app/views/common/_diff.rhtml (working copy)
|
| 19 |
@@ -1,4 +1,5 @@
|
| 20 |
-<% Redmine::UnifiedDiff.new(diff, :type => diff_type).each do |table_file| -%>
|
| 21 |
+<% diff = Redmine::UnifiedDiff.new(diff, :type => diff_type, :max_lines => Setting.diff_max_lines_displayed.to_i) -%>
|
| 22 |
+<% diff.each do |table_file| -%>
|
| 23 |
<div class="autoscroll"> |
| 24 |
<% if diff_type == 'sbs' -%>
|
| 25 |
<table class="filecontent CodeRay"> |
| 26 |
@@ -62,3 +63,5 @@
|
| 27 |
|
| 28 |
</div>
|
| 29 |
<% end -%>
|
| 30 |
+
|
| 31 |
+<%= l(:text_diff_truncated) if diff.truncated? %>
|
| 32 |
Index: lang/lt.yml
|
| 33 |
===================================================================
|
| 34 |
--- config/settings.yml (revision 2094)
|
| 35 |
+++ config/settings.yml (working copy)
|
| 36 |
@@ -61,6 +61,9 @@
|
| 37 |
feeds_limit:
|
| 38 |
format: int |
| 39 |
default: 15 |
| 40 |
+diff_max_lines_displayed:
|
| 41 |
+ format: int
|
| 42 |
+ default: 1500
|
| 43 |
enabled_scm:
|
| 44 |
serialized: true |
| 45 |
default:
|
| 46 |
Index: lib/redmine/unified_diff.rb
|
| 47 |
===================================================================
|
| 48 |
--- lib/redmine/unified_diff.rb (revision 2110)
|
| 49 |
+++ lib/redmine/unified_diff.rb (working copy)
|
| 50 |
@@ -19,8 +19,11 @@
|
| 51 |
# Class used to parse unified diffs
|
| 52 |
class UnifiedDiff < Array |
| 53 |
def initialize(diff, options={}) |
| 54 |
+ options.assert_valid_keys(:type, :max_lines)
|
| 55 |
diff_type = options[:type] || 'inline' |
| 56 |
|
| 57 |
+ lines = 0
|
| 58 |
+ @truncated = false
|
| 59 |
diff_table = DiffTable.new(diff_type)
|
| 60 |
diff.each do |line|
|
| 61 |
if line =~ /^(---|\+\+\+) (.*)$/ |
| 62 |
@@ -28,10 +31,17 @@
|
| 63 |
diff_table = DiffTable.new(diff_type)
|
| 64 |
end
|
| 65 |
diff_table.add_line line |
| 66 |
+ lines += 1
|
| 67 |
+ if options[:max_lines] && lines > options[:max_lines]
|
| 68 |
+ @truncated = true
|
| 69 |
+ break
|
| 70 |
+ end
|
| 71 |
end
|
| 72 |
self << diff_table unless diff_table.empty? |
| 73 |
self
|
| 74 |
end
|
| 75 |
+
|
| 76 |
+ def truncated?; @truncated; end
|
| 77 |
end
|
| 78 |
|
| 79 |
# Class that represents a file diff
|