##// END OF EJS Templates
Always show 'View' and 'Annotate' links on repository files (download will be forced when clicking 'View' if the file is binary)....
Jean-Philippe Lang -
r1259:f162337e1b36
parent child
Show More
@@ -110,7 +110,7 class RepositoriesController < ApplicationController
110 110
111 111 def annotate
112 112 @annotate = @repository.scm.annotate(@path, @rev)
113 show_error_not_found and return if @annotate.nil? || @annotate.empty?
113 render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
114 114 rescue Redmine::Scm::Adapters::CommandFailed => e
115 115 show_error_command_failed(e.message)
116 116 end
@@ -3,13 +3,11
3 3 <h3><%=h @entry.name %></h3>
4 4
5 5 <p>
6 <% if @entry.is_text? %>
7 <% if @repository.supports_cat? %>
8 <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
9 <% end %>
10 <% if @repository.supports_annotate? %>
11 <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
12 <% end %>
6 <% if @repository.supports_cat? %>
7 <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
8 <% end %>
9 <% if @repository.supports_annotate? %>
10 <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
13 11 <% end %>
14 12 <%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
15 13 <%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -617,3 +617,4 default_activity_development: Vývoj
617 617 enumeration_issue_priorities: Priority úkolů
618 618 enumeration_doc_categories: Kategorie dokumentů
619 619 enumeration_activities: Aktivity (sledování času)
620 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
617 617 label_preferences: Preferences
618 618 label_overall_activity: Overall activity
619 619 setting_default_projects_public: New projects are public by default
620 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 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
78 78 notice_default_data_loaded: Default configuration successfully loaded.
79 79
80 80 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
81 error_scm_not_found: "Entry and/or revision doesn't exist in the repository."
81 error_scm_not_found: "The entry or revision was not found in the repository."
82 82 error_scm_command_failed: "An error occurred when trying to access the repository: %s"
83 error_scm_annotate: "The entry does not exist or can not be annotated."
83 84 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
84 85
85 86 mail_subject_lost_password: Your %s password
@@ -618,3 +618,4 label_preferences: Preferences
618 618 setting_display_subprojects_issues: Display subprojects issues on main projects by default
619 619 label_overall_activity: Overall activity
620 620 setting_default_projects_public: New projects are public by default
621 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ä
615 615 label_preferences: Asetukset
616 616 setting_default_projects_public: New projects are public by default
617 617 label_overall_activity: Overall activity
618 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.
80 80 error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage: %s"
81 81 error_scm_not_found: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt."
82 82 error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt: %s"
83 error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
83 84 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
84 85
85 86 mail_subject_lost_password: Votre mot de passe %s
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 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
615 615 label_preferences: Preferences
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -615,3 +615,4 label_preferences: Preferences
615 615 setting_display_subprojects_issues: Display subprojects issues on main projects by default
616 616 label_overall_activity: Overall activity
617 617 setting_default_projects_public: New projects are public by default
618 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -619,3 +619,4 label_preferences: Preferences
619 619 setting_display_subprojects_issues: Display subprojects issues on main projects by default
620 620 label_overall_activity: Overall activity
621 621 setting_default_projects_public: New projects are public by default
622 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 label_preferences: Preferences
616 616 setting_display_subprojects_issues: Display subprojects issues on main projects by default
617 617 label_overall_activity: Overall activity
618 618 setting_default_projects_public: New projects are public by default
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -617,3 +617,4 label_preferences: Preferences
617 617 setting_display_subprojects_issues: Display subprojects issues on main projects by default
618 618 label_overall_activity: Overall activity
619 619 setting_default_projects_public: New projects are public by default
620 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 default_activity_development: 開發
616 616 enumeration_issue_priorities: 項目優先權
617 617 enumeration_doc_categories: 文件分類
618 618 enumeration_activities: 活動 (時間追蹤)
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -616,3 +616,4 enumeration_issue_priorities: 问题优先级
616 616 enumeration_doc_categories: 文档类别
617 617 enumeration_activities: 活动(时间跟踪)
618 618 setting_default_projects_public: New projects are public by default
619 error_scm_annotate: "The entry does not exist or can not be annotated."
@@ -23,7 +23,7 module Redmine
23 23 'text/css' => 'css',
24 24 'text/html' => 'html,htm,xhtml',
25 25 'text/jsp' => 'jsp',
26 'text/x-c' => 'c,cpp,h',
26 'text/x-c' => 'c,cpp,cc,h,hh',
27 27 'text/x-java' => 'java',
28 28 'text/x-javascript' => 'js',
29 29 'text/x-html-template' => 'rhtml',
@@ -231,13 +231,15 module Redmine
231 231 identifier = 'HEAD' if identifier.blank?
232 232 cmd = "#{GIT_BIN} --git-dir #{target('')} blame -l #{shell_quote identifier} -- #{shell_quote path}"
233 233 blame = Annotate.new
234 shellout(cmd) do |io|
235 io.each_line do |line|
236 next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)$/
237 blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
238 end
239 end
234 content = nil
235 shellout(cmd) { |io| io.binmode; content = io.read }
240 236 return nil if $? && $?.exitstatus != 0
237 # git annotates binary files
238 return nil if content.is_binary_data?
239 content.split("\n").each do |line|
240 next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)/
241 blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
242 end
241 243 blame
242 244 end
243 245
@@ -83,7 +83,7 class RepositoriesCvsControllerTest < Test::Unit::TestCase
83 83 def test_entry_not_found
84 84 get :entry, :id => 1, :path => ['sources', 'zzz.c']
85 85 assert_tag :tag => 'div', :attributes => { :class => /error/ },
86 :content => /Entry and\/or revision doesn't exist/
86 :content => /The entry or revision was not found in the repository/
87 87 end
88 88
89 89 def test_entry_download
@@ -116,6 +116,13 class RepositoriesGitControllerTest < Test::Unit::TestCase
116 116 :sibling => { :tag => 'td', :content => /jsmith/ },
117 117 :sibling => { :tag => 'td', :content => /watcher =/ }
118 118 end
119
120 def test_annotate_binary_file
121 get :annotate, :id => 3, :path => ['images', 'delete.png']
122 assert_response 500
123 assert_tag :tag => 'div', :attributes => { :class => /error/ },
124 :content => /can not be annotated/
125 end
119 126 else
120 127 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
121 128 def test_fake; assert true end
@@ -72,7 +72,7 class RepositoriesSubversionControllerTest < Test::Unit::TestCase
72 72 def test_entry_not_found
73 73 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
74 74 assert_tag :tag => 'div', :attributes => { :class => /error/ },
75 :content => /Entry and\/or revision doesn't exist/
75 :content => /The entry or revision was not found in the repository/
76 76 end
77 77
78 78 def test_entry_download
General Comments 0
You need to be logged in to leave comments. Login now