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