Fixed: log is not displayed when browsing a copy in a svn repository.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@843 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-10-15 18:41:27 +00:00
parent b9cc65db61
commit 9ce5713ee4
5 changed files with 17 additions and 7 deletions

View File

@ -62,9 +62,7 @@ class RepositoriesController < ApplicationController
def changes def changes
@entry = @repository.scm.entry(@path, @rev) @entry = @repository.scm.entry(@path, @rev)
show_error and return unless @entry show_error and return unless @entry
@changes = Change.find(:all, :include => :changeset, @changesets = @repository.changesets_for_path(@path)
:conditions => ["repository_id = ? AND path = ?", @repository.id, @path.with_leading_slash],
:order => "committed_on DESC")
end end
def revisions def revisions

View File

@ -42,6 +42,14 @@ class Repository < ActiveRecord::Base
scm.diff(path, rev, rev_to, type) scm.diff(path, rev, rev_to, type)
end end
# Default behaviour: we search in cached changesets
def changesets_for_path(path)
path = "/#{path}" unless path.starts_with?('/')
Change.find(:all, :include => :changeset,
:conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset)
end
def latest_changeset def latest_changeset
@latest_changeset ||= changesets.find(:first) @latest_changeset ||= changesets.find(:first)
end end

View File

@ -30,6 +30,11 @@ class Repository::Subversion < Repository
'Subversion' 'Subversion'
end end
def changesets_for_path(path)
revisions = scm.revisions(path)
revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC") : []
end
def fetch_changesets def fetch_changesets
scm_info = scm.info scm_info = scm.info
if scm_info if scm_info

View File

@ -11,10 +11,9 @@
<tbody> <tbody>
<% show_diff = entry && entry.is_file? && revisions.size > 1 %> <% show_diff = entry && entry.is_file? && revisions.size > 1 %>
<% line_num = 1 %> <% line_num = 1 %>
<% revisions.each do |revision| %> <% revisions.each do |changeset| %>
<% changeset = revision.is_a?(Change) ? revision.changeset : revision %>
<tr class="<%= cycle 'odd', 'even' %>"> <tr class="<%= cycle 'odd', 'even' %>">
<td class="id"><%= link_to (revision.revision || changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %></th> <td class="id"><%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %></th>
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td> <td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td> <td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
<td align="center" style="width:15%"><%= format_time(changeset.committed_on) %></td> <td align="center" style="width:15%"><%= format_time(changeset.committed_on) %></td>

View File

@ -12,4 +12,4 @@
</p> </p>
<% end %> <% end %>
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changes, :entry => @entry }%> <%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }%>