Don't repeat revision on annotate view.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10105 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
138f6736b2
commit
65524cc1cc
|
@ -13,17 +13,17 @@
|
||||||
<div class="autoscroll">
|
<div class="autoscroll">
|
||||||
<table class="filecontent annotate syntaxhl">
|
<table class="filecontent annotate syntaxhl">
|
||||||
<tbody>
|
<tbody>
|
||||||
<% line_num = 1 %>
|
<% line_num = 1; previous_revision = nil %>
|
||||||
<% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
|
<% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
|
||||||
<% revision = @annotate.revisions[line_num - 1] %>
|
<% revision = @annotate.revisions[line_num - 1] %>
|
||||||
<tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
|
<tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
|
||||||
<th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th>
|
<th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th>
|
||||||
<td class="revision">
|
<td class="revision">
|
||||||
<%= (revision.identifier ? link_to_revision(revision, @repository) : format_revision(revision)) if revision %></td>
|
<%= (revision.identifier ? link_to_revision(revision, @repository) : format_revision(revision)) if revision && revision != previous_revision %></td>
|
||||||
<td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td>
|
<td class="author"><%= h(revision.author.to_s.split('<').first) if revision && revision != previous_revision %></td>
|
||||||
<td class="line-code"><pre><%= line.html_safe %></pre></td>
|
<td class="line-code"><pre><%= line.html_safe %></pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% line_num += 1 %>
|
<% line_num += 1; previous_revision = revision %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -366,6 +366,18 @@ module Redmine
|
||||||
def format_identifier
|
def format_identifier
|
||||||
self.identifier.to_s
|
self.identifier.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ==(other)
|
||||||
|
if other.nil?
|
||||||
|
false
|
||||||
|
elsif scmid.present?
|
||||||
|
scmid == other.scmid
|
||||||
|
elsif identifier.present?
|
||||||
|
identifier == other.identifier
|
||||||
|
elsif revision.present?
|
||||||
|
revision == other.revision
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Annotate
|
class Annotate
|
||||||
|
|
|
@ -220,7 +220,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
|
||||||
# 1.1 line
|
# 1.1 line
|
||||||
assert_tag :tag => 'th',
|
assert_tag :tag => 'th',
|
||||||
:attributes => { :class => 'line-num' },
|
:attributes => { :class => 'line-num' },
|
||||||
:content => '18',
|
:content => '21',
|
||||||
:sibling => {
|
:sibling => {
|
||||||
:tag => 'td',
|
:tag => 'td',
|
||||||
:attributes => { :class => 'revision' },
|
:attributes => { :class => 'revision' },
|
||||||
|
|
|
@ -383,8 +383,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
|
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
# Line 24, changeset 2f9c0091
|
# Line 23, changeset 2f9c0091
|
||||||
assert_tag :tag => 'th', :content => '24',
|
assert_tag :tag => 'th', :content => '23',
|
||||||
:sibling => {
|
:sibling => {
|
||||||
:tag => 'td',
|
:tag => 'td',
|
||||||
:child => {
|
:child => {
|
||||||
|
@ -392,9 +392,9 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
:content => /2f9c0091/
|
:content => /2f9c0091/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_tag :tag => 'th', :content => '24',
|
assert_tag :tag => 'th', :content => '23',
|
||||||
:sibling => { :tag => 'td', :content => /jsmith/ }
|
:sibling => { :tag => 'td', :content => /jsmith/ }
|
||||||
assert_tag :tag => 'th', :content => '24',
|
assert_tag :tag => 'th', :content => '23',
|
||||||
:sibling => {
|
:sibling => {
|
||||||
:tag => 'td',
|
:tag => 'td',
|
||||||
:child => {
|
:child => {
|
||||||
|
@ -402,8 +402,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
:content => /2f9c0091/
|
:content => /2f9c0091/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_tag :tag => 'th', :content => '24',
|
assert_tag :tag => 'th', :content => '23',
|
||||||
:sibling => { :tag => 'td', :content => /watcher =/ }
|
:sibling => { :tag => 'td', :content => /remove_watcher/ }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate_at_given_revision
|
def test_annotate_at_given_revision
|
||||||
|
|
|
@ -376,9 +376,9 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
||||||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
|
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
# Line 23, revision 4:def6d2f1254a
|
# Line 22, revision 4:def6d2f1254a
|
||||||
assert_tag :tag => 'th',
|
assert_tag :tag => 'th',
|
||||||
:content => '23',
|
:content => '22',
|
||||||
:attributes => { :class => 'line-num' },
|
:attributes => { :class => 'line-num' },
|
||||||
:sibling =>
|
:sibling =>
|
||||||
{
|
{
|
||||||
|
@ -387,7 +387,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
||||||
:child => { :tag => 'a', :content => '4:def6d2f1254a' }
|
:child => { :tag => 'a', :content => '4:def6d2f1254a' }
|
||||||
}
|
}
|
||||||
assert_tag :tag => 'th',
|
assert_tag :tag => 'th',
|
||||||
:content => '23',
|
:content => '22',
|
||||||
:attributes => { :class => 'line-num' },
|
:attributes => { :class => 'line-num' },
|
||||||
:sibling =>
|
:sibling =>
|
||||||
{
|
{
|
||||||
|
@ -396,9 +396,9 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
||||||
:attributes => { :class => 'author' },
|
:attributes => { :class => 'author' },
|
||||||
}
|
}
|
||||||
assert_tag :tag => 'th',
|
assert_tag :tag => 'th',
|
||||||
:content => '23',
|
:content => '22',
|
||||||
:attributes => { :class => 'line-num' },
|
:attributes => { :class => 'line-num' },
|
||||||
:sibling => { :tag => 'td', :content => /watcher =/ }
|
:sibling => { :tag => 'td', :content => /remove_watcher/ }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate_not_in_tip
|
def test_annotate_not_in_tip
|
||||||
|
|
Loading…
Reference in New Issue