@@ -26,7 +26,9 | |||
|
26 | 26 | </td> |
|
27 | 27 | <td class="author"> |
|
28 | 28 | <% if revision && revision != previous_revision %> |
|
29 | <%= revision.author.to_s.split('<').first %> | |
|
29 | <% author = Redmine::CodesetUtil.to_utf8(revision.author.to_s, | |
|
30 | @repository.repo_log_encoding) %> | |
|
31 | <%= author.split('<').first %> | |
|
30 | 32 | <% end %> |
|
31 | 33 | </td> |
|
32 | 34 | <td class="line-code"><pre><%= line.html_safe %></pre></td> |
@@ -26,6 +26,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
26 | 26 | REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s |
|
27 | 27 | REPOSITORY_PATH_TRUNK = File.join(REPOSITORY_PATH, "trunk") |
|
28 | 28 | PRJ_ID = 3 |
|
29 | CHAR_1_UTF8_HEX = "\xc3\x9c" | |
|
29 | 30 | |
|
30 | 31 | def setup |
|
31 | 32 | User.current = nil |
@@ -35,6 +36,10 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
35 | 36 | :url => REPOSITORY_PATH_TRUNK, |
|
36 | 37 | :log_encoding => 'UTF-8') |
|
37 | 38 | assert @repository |
|
39 | @char_1_utf8 = CHAR_1_UTF8_HEX.dup | |
|
40 | if @char_1_utf8.respond_to?(:force_encoding) | |
|
41 | @char_1_utf8.force_encoding('UTF-8') | |
|
42 | end | |
|
38 | 43 | end |
|
39 | 44 | |
|
40 | 45 | if File.directory?(REPOSITORY_PATH) |
@@ -171,6 +176,37 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
171 | 176 | end |
|
172 | 177 | end |
|
173 | 178 | |
|
179 | if REPOSITORY_PATH.respond_to?(:force_encoding) | |
|
180 | def test_annotate_author_non_ascii | |
|
181 | log_encoding = nil | |
|
182 | if Encoding.locale_charmap == "UTF-8" || | |
|
183 | Encoding.locale_charmap == "ISO-8859-1" | |
|
184 | log_encoding = Encoding.locale_charmap | |
|
185 | end | |
|
186 | unless log_encoding.nil? | |
|
187 | repository = Repository::Bazaar.create( | |
|
188 | :project => @project, | |
|
189 | :url => File.join(REPOSITORY_PATH, "author_non_ascii"), | |
|
190 | :identifier => 'author_non_ascii', | |
|
191 | :log_encoding => log_encoding) | |
|
192 | assert repository | |
|
193 | get :annotate, :id => PRJ_ID, :repository_id => 'author_non_ascii', | |
|
194 | :path => repository_path_hash(['author-non-ascii-test.txt'])[:param] | |
|
195 | assert_response :success | |
|
196 | assert_template 'annotate' | |
|
197 | assert_select "th.line-num", :text => '1' do | |
|
198 | assert_select "+ td.revision" do | |
|
199 | assert_select "a", :text => '2' | |
|
200 | assert_select "+ td.author", :text => "test #{@char_1_utf8}" do | |
|
201 | assert_select "+ td", | |
|
202 | :text => "author non ASCII test" | |
|
203 | end | |
|
204 | end | |
|
205 | end | |
|
206 | end | |
|
207 | end | |
|
208 | end | |
|
209 | ||
|
174 | 210 | def test_destroy_valid_repository |
|
175 | 211 | @request.session[:user_id] = 1 # admin |
|
176 | 212 | assert_equal 0, @repository.changesets.count |
@@ -27,6 +27,7 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
27 | 27 | REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
|
28 | 28 | PRJ_ID = 3 |
|
29 | 29 | CHAR_1_HEX = "\xc3\x9c" |
|
30 | FELIX_HEX = "Felix Sch\xC3\xA4fer" | |
|
30 | 31 | NUM_REV = 28 |
|
31 | 32 | |
|
32 | 33 | ## Git, Mercurial and CVS path encodings are binary. |
@@ -50,8 +51,10 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
50 | 51 | ) |
|
51 | 52 | assert @repository |
|
52 | 53 | @char_1 = CHAR_1_HEX.dup |
|
54 | @felix_utf8 = FELIX_HEX.dup | |
|
53 | 55 | if @char_1.respond_to?(:force_encoding) |
|
54 | 56 | @char_1.force_encoding('UTF-8') |
|
57 | @felix_utf8.force_encoding('UTF-8') | |
|
55 | 58 | end |
|
56 | 59 | end |
|
57 | 60 | |
@@ -546,6 +549,23 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
546 | 549 | end |
|
547 | 550 | end |
|
548 | 551 | |
|
552 | def test_annotate_latin_1_author | |
|
553 | ['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1| | |
|
554 | get :annotate, :id => PRJ_ID, | |
|
555 | :path => repository_path_hash([" filename with a leading space.txt "])[:param], | |
|
556 | :rev => r1 | |
|
557 | assert_select "th.line-num", :text => '1' do | |
|
558 | assert_select "+ td.revision" do | |
|
559 | assert_select "a", :text => '83ca5fd5' | |
|
560 | assert_select "+ td.author", :text => @felix_utf8 do | |
|
561 | assert_select "+ td", | |
|
562 | :text => "And this is a file with a leading and trailing space..." | |
|
563 | end | |
|
564 | end | |
|
565 | end | |
|
566 | end | |
|
567 | end | |
|
568 | ||
|
549 | 569 | def test_revisions |
|
550 | 570 | assert_equal 0, @repository.changesets.count |
|
551 | 571 | @repository.fetch_changesets |
General Comments 0
You need to be logged in to leave comments.
Login now