Commit 9ce5713e authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

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
parent b9cc65db
......@@ -62,9 +62,7 @@ class RepositoriesController < ApplicationController
def changes
@entry = @repository.scm.entry(@path, @rev)
show_error and return unless @entry
@changes = Change.find(:all, :include => :changeset,
:conditions => ["repository_id = ? AND path = ?", @repository.id, @path.with_leading_slash],
:order => "committed_on DESC")
@changesets = @repository.changesets_for_path(@path)
end
def revisions
......
......@@ -42,6 +42,14 @@ class Repository < ActiveRecord::Base
scm.diff(path, rev, rev_to, type)
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
@latest_changeset ||= changesets.find(:first)
end
......
......@@ -30,6 +30,11 @@ class Repository::Subversion < Repository
'Subversion'
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
scm_info = scm.info
if scm_info
......
......@@ -11,10 +11,9 @@
<tbody>
<% show_diff = entry && entry.is_file? && revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |revision| %>
<% changeset = revision.is_a?(Change) ? revision.changeset : revision %>
<% revisions.each do |changeset| %>
<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_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>
......
......@@ -12,4 +12,4 @@
</p>
<% 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 }%>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment