git-svn-id: http://redmine.rubyforge.org/svn/trunk@1274 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/0.7.0-RC1
@@ -110,7 +110,7 @@ class RepositoriesController < ApplicationController | |||
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 |
@@ -3,13 +3,11 @@ | |||
<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 %> |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -617,3 +617,4 @@ default_activity_development: Vývoj | |||
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." |
@@ -617,3 +617,4 @@ label_reverse_chronological_order: In reverse chronological order | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -78,8 +78,9 @@ notice_account_pending: "Your account was created and is now pending administrat | |||
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 |
@@ -618,3 +618,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_reverse_chronological_order: Käänteisessä aikajärjestyksessä | |||
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." |
@@ -80,6 +80,7 @@ notice_default_data_loaded: Paramétrage par défaut chargé avec succès. | |||
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 |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_reverse_chronological_order: In reverse chronological order | |||
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." |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -615,3 +615,4 @@ label_preferences: Preferences | |||
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." |
@@ -619,3 +619,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ label_preferences: Preferences | |||
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." |
@@ -617,3 +617,4 @@ label_preferences: Preferences | |||
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." |
@@ -616,3 +616,4 @@ default_activity_development: 開發 | |||
enumeration_issue_priorities: 項目優先權 | |||
enumeration_doc_categories: 文件分類 | |||
enumeration_activities: 活動 (時間追蹤) | |||
error_scm_annotate: "The entry does not exist or can not be annotated." |
@@ -616,3 +616,4 @@ enumeration_issue_priorities: 问题优先级 | |||
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." |
@@ -23,7 +23,7 @@ module Redmine | |||
'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', |
@@ -231,13 +231,15 @@ module Redmine | |||
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 | |||
@@ -83,7 +83,7 @@ class RepositoriesCvsControllerTest < Test::Unit::TestCase | |||
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 |
@@ -116,6 +116,13 @@ class RepositoriesGitControllerTest < Test::Unit::TestCase | |||
: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 |
@@ -72,7 +72,7 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase | |||
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 |