@annotate = @repository.scm.annotate(@path, @rev)
if @annotate.nil? || @annotate.empty?
- (render_error l(:error_scm_annotate); return)
- end
- ann_buf_size = 0
- @annotate.lines.each do |buf|
- ann_buf_size += buf.size
- end
- if ann_buf_size > Setting.file_max_size_displayed.to_i.kilobyte
- (render_error l(:error_scm_annotate_big_text_file); return)
+ @annotate = nil
+ @error_message = l(:error_scm_annotate)
+ else
+ ann_buf_size = 0
+ @annotate.lines.each do |buf|
+ ann_buf_size += buf.size
+ end
+ if ann_buf_size > Setting.file_max_size_displayed.to_i.kilobyte
+ @annotate = nil
+ @error_message = l(:error_scm_annotate_big_text_file)
+ end
end
@changeset = @repository.find_changeset_by_name(@rev)
end
<%= render :partial => 'link_to_functions' %>
+<% if @annotate %>
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
-
<div class="autoscroll">
<table class="filecontent annotate syntaxhl">
<tbody>
</tbody>
</table>
</div>
+<% else %>
+<p id="errorExplanation"><%= @error_message %></p>
+<% end %>
<% html_title(l(:button_annotate)) -%>
with_settings :default_language => 'en' do
get :annotate, :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
- assert_response 500
+ assert_response 200
assert_select 'p#errorExplanation', :text => /cannot be annotated/
end
end
get :annotate, :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:rev => 'deff712f'
- assert_response 500
+ assert_response 200
assert_select 'p#errorExplanation', :text => /exceeds the maximum text file size/
get :annotate, :id => PRJ_ID,