@@ -13,17 +13,17 | |||||
13 | <div class="autoscroll"> |
|
13 | <div class="autoscroll"> | |
14 | <table class="filecontent annotate syntaxhl"> |
|
14 | <table class="filecontent annotate syntaxhl"> | |
15 | <tbody> |
|
15 | <tbody> | |
16 | <% line_num = 1 %> |
|
16 | <% line_num = 1; previous_revision = nil %> | |
17 | <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %> |
|
17 | <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %> | |
18 | <% revision = @annotate.revisions[line_num - 1] %> |
|
18 | <% revision = @annotate.revisions[line_num - 1] %> | |
19 | <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>"> |
|
19 | <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>"> | |
20 | <th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th> |
|
20 | <th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th> | |
21 | <td class="revision"> |
|
21 | <td class="revision"> | |
22 | <%= (revision.identifier ? link_to_revision(revision, @repository) : format_revision(revision)) if revision %></td> |
|
22 | <%= (revision.identifier ? link_to_revision(revision, @repository) : format_revision(revision)) if revision && revision != previous_revision %></td> | |
23 | <td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td> |
|
23 | <td class="author"><%= h(revision.author.to_s.split('<').first) if revision && revision != previous_revision %></td> | |
24 | <td class="line-code"><pre><%= line.html_safe %></pre></td> |
|
24 | <td class="line-code"><pre><%= line.html_safe %></pre></td> | |
25 | </tr> |
|
25 | </tr> | |
26 | <% line_num += 1 %> |
|
26 | <% line_num += 1; previous_revision = revision %> | |
27 | <% end %> |
|
27 | <% end %> | |
28 | </tbody> |
|
28 | </tbody> | |
29 | </table> |
|
29 | </table> |
@@ -366,6 +366,18 module Redmine | |||||
366 | def format_identifier |
|
366 | def format_identifier | |
367 | self.identifier.to_s |
|
367 | self.identifier.to_s | |
368 | end |
|
368 | end | |
|
369 | ||||
|
370 | def ==(other) | |||
|
371 | if other.nil? | |||
|
372 | false | |||
|
373 | elsif scmid.present? | |||
|
374 | scmid == other.scmid | |||
|
375 | elsif identifier.present? | |||
|
376 | identifier == other.identifier | |||
|
377 | elsif revision.present? | |||
|
378 | revision == other.revision | |||
|
379 | end | |||
|
380 | end | |||
369 | end |
|
381 | end | |
370 |
|
382 | |||
371 | class Annotate |
|
383 | class Annotate |
@@ -220,7 +220,7 class RepositoriesCvsControllerTest < ActionController::TestCase | |||||
220 | # 1.1 line |
|
220 | # 1.1 line | |
221 | assert_tag :tag => 'th', |
|
221 | assert_tag :tag => 'th', | |
222 | :attributes => { :class => 'line-num' }, |
|
222 | :attributes => { :class => 'line-num' }, | |
223 |
:content => '1 |
|
223 | :content => '21', | |
224 | :sibling => { |
|
224 | :sibling => { | |
225 | :tag => 'td', |
|
225 | :tag => 'td', | |
226 | :attributes => { :class => 'revision' }, |
|
226 | :attributes => { :class => 'revision' }, |
@@ -383,8 +383,8 class RepositoriesGitControllerTest < ActionController::TestCase | |||||
383 | :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] |
|
383 | :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |
384 | assert_response :success |
|
384 | assert_response :success | |
385 | assert_template 'annotate' |
|
385 | assert_template 'annotate' | |
386 |
# Line 2 |
|
386 | # Line 23, changeset 2f9c0091 | |
387 |
assert_tag :tag => 'th', :content => '2 |
|
387 | assert_tag :tag => 'th', :content => '23', | |
388 | :sibling => { |
|
388 | :sibling => { | |
389 | :tag => 'td', |
|
389 | :tag => 'td', | |
390 | :child => { |
|
390 | :child => { | |
@@ -392,9 +392,9 class RepositoriesGitControllerTest < ActionController::TestCase | |||||
392 | :content => /2f9c0091/ |
|
392 | :content => /2f9c0091/ | |
393 | } |
|
393 | } | |
394 | } |
|
394 | } | |
395 |
assert_tag :tag => 'th', :content => '2 |
|
395 | assert_tag :tag => 'th', :content => '23', | |
396 | :sibling => { :tag => 'td', :content => /jsmith/ } |
|
396 | :sibling => { :tag => 'td', :content => /jsmith/ } | |
397 |
assert_tag :tag => 'th', :content => '2 |
|
397 | assert_tag :tag => 'th', :content => '23', | |
398 | :sibling => { |
|
398 | :sibling => { | |
399 | :tag => 'td', |
|
399 | :tag => 'td', | |
400 | :child => { |
|
400 | :child => { | |
@@ -402,8 +402,8 class RepositoriesGitControllerTest < ActionController::TestCase | |||||
402 | :content => /2f9c0091/ |
|
402 | :content => /2f9c0091/ | |
403 | } |
|
403 | } | |
404 | } |
|
404 | } | |
405 |
assert_tag :tag => 'th', :content => '2 |
|
405 | assert_tag :tag => 'th', :content => '23', | |
406 |
:sibling => { :tag => 'td', :content => /watcher |
|
406 | :sibling => { :tag => 'td', :content => /remove_watcher/ } | |
407 | end |
|
407 | end | |
408 |
|
408 | |||
409 | def test_annotate_at_given_revision |
|
409 | def test_annotate_at_given_revision |
@@ -376,9 +376,9 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
376 | :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] |
|
376 | :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |
377 | assert_response :success |
|
377 | assert_response :success | |
378 | assert_template 'annotate' |
|
378 | assert_template 'annotate' | |
379 |
# Line 2 |
|
379 | # Line 22, revision 4:def6d2f1254a | |
380 | assert_tag :tag => 'th', |
|
380 | assert_tag :tag => 'th', | |
381 |
:content => '2 |
|
381 | :content => '22', | |
382 | :attributes => { :class => 'line-num' }, |
|
382 | :attributes => { :class => 'line-num' }, | |
383 | :sibling => |
|
383 | :sibling => | |
384 | { |
|
384 | { | |
@@ -387,7 +387,7 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
387 | :child => { :tag => 'a', :content => '4:def6d2f1254a' } |
|
387 | :child => { :tag => 'a', :content => '4:def6d2f1254a' } | |
388 | } |
|
388 | } | |
389 | assert_tag :tag => 'th', |
|
389 | assert_tag :tag => 'th', | |
390 |
:content => '2 |
|
390 | :content => '22', | |
391 | :attributes => { :class => 'line-num' }, |
|
391 | :attributes => { :class => 'line-num' }, | |
392 | :sibling => |
|
392 | :sibling => | |
393 | { |
|
393 | { | |
@@ -396,9 +396,9 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
396 | :attributes => { :class => 'author' }, |
|
396 | :attributes => { :class => 'author' }, | |
397 | } |
|
397 | } | |
398 | assert_tag :tag => 'th', |
|
398 | assert_tag :tag => 'th', | |
399 |
:content => '2 |
|
399 | :content => '22', | |
400 | :attributes => { :class => 'line-num' }, |
|
400 | :attributes => { :class => 'line-num' }, | |
401 |
:sibling => { :tag => 'td', :content => /watcher |
|
401 | :sibling => { :tag => 'td', :content => /remove_watcher/ } | |
402 | end |
|
402 | end | |
403 |
|
403 | |||
404 | def test_annotate_not_in_tip |
|
404 | def test_annotate_not_in_tip |
General Comments 0
You need to be logged in to leave comments.
Login now