def annotate
@annotate = @repository.scm.annotate(@path, @rev)
- show_error_not_found and return if @annotate.nil? || @annotate.empty?
+ render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
rescue Redmine::Scm::Adapters::CommandFailed => e
show_error_command_failed(e.message)
end
<h3><%=h @entry.name %></h3>
<p>
-<% if @entry.is_text? %>
- <% if @repository.supports_cat? %>
- <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
- <% end %>
- <% if @repository.supports_annotate? %>
- <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
- <% end %>
+<% if @repository.supports_cat? %>
+ <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
+<% end %>
+<% if @repository.supports_annotate? %>
+ <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
<% end %>
<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
enumeration_issue_priorities: Priority úkolů
enumeration_doc_categories: Kategorie dokumentů
enumeration_activities: Aktivity (sledování času)
+error_scm_annotate: "The entry does not exist or can not be annotated."
label_preferences: Preferences
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
notice_default_data_loaded: Default configuration successfully loaded.
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
-error_scm_not_found: "Entry and/or revision doesn't exist in the repository."
+error_scm_not_found: "The entry or revision was not found in the repository."
error_scm_command_failed: "An error occurred when trying to access the repository: %s"
+error_scm_annotate: "The entry does not exist or can not be annotated."
error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
mail_subject_lost_password: Your %s password
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
label_preferences: Asetukset
setting_default_projects_public: New projects are public by default
label_overall_activity: Overall activity
+error_scm_annotate: "The entry does not exist or can not be annotated."
error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage: %s"
error_scm_not_found: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt."
error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt: %s"
+error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
mail_subject_lost_password: Votre mot de passe %s
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
label_preferences: Preferences
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default\r
label_overall_activity: Overall activity\r
setting_default_projects_public: New projects are public by default\r
+error_scm_annotate: "The entry does not exist or can not be annotated."\r
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
setting_display_subprojects_issues: Display subprojects issues on main projects by default
label_overall_activity: Overall activity
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
enumeration_issue_priorities: 項目優先權
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
+error_scm_annotate: "The entry does not exist or can not be annotated."
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
setting_default_projects_public: New projects are public by default
+error_scm_annotate: "The entry does not exist or can not be annotated."
'text/css' => 'css',
'text/html' => 'html,htm,xhtml',
'text/jsp' => 'jsp',
- 'text/x-c' => 'c,cpp,h',
+ 'text/x-c' => 'c,cpp,cc,h,hh',
'text/x-java' => 'java',
'text/x-javascript' => 'js',
'text/x-html-template' => 'rhtml',
identifier = 'HEAD' if identifier.blank?
cmd = "#{GIT_BIN} --git-dir #{target('')} blame -l #{shell_quote identifier} -- #{shell_quote path}"
blame = Annotate.new
- shellout(cmd) do |io|
- io.each_line do |line|
- next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)$/
- blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
- end
- end
+ content = nil
+ shellout(cmd) { |io| io.binmode; content = io.read }
return nil if $? && $?.exitstatus != 0
+ # git annotates binary files
+ return nil if content.is_binary_data?
+ content.split("\n").each do |line|
+ next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)/
+ blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
+ end
blame
end
def test_entry_not_found
get :entry, :id => 1, :path => ['sources', 'zzz.c']
assert_tag :tag => 'div', :attributes => { :class => /error/ },
- :content => /Entry and\/or revision doesn't exist/
+ :content => /The entry or revision was not found in the repository/
end
def test_entry_download
:sibling => { :tag => 'td', :content => /jsmith/ },
:sibling => { :tag => 'td', :content => /watcher =/ }
end
+
+ def test_annotate_binary_file
+ get :annotate, :id => 3, :path => ['images', 'delete.png']
+ assert_response 500
+ assert_tag :tag => 'div', :attributes => { :class => /error/ },
+ :content => /can not be annotated/
+ end
else
puts "Git test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
def test_entry_not_found
get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
assert_tag :tag => 'div', :attributes => { :class => /error/ },
- :content => /Entry and\/or revision doesn't exist/
+ :content => /The entry or revision was not found in the repository/
end
def test_entry_download