Project

General

Profile

Patch #6159 » latest-changesets-improvements.diff

Yuya Nishihara, 2010-08-19 16:21

View differences:

app/models/repository.rb
# Default behaviour is to search in cached changesets
def latest_changesets(path, rev, limit=10)
if path.blank?
changesets.find(:all, :include => :user,
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit)
changesets.find(:all, :include => :user, :limit => limit)
else
changes.find(:all, :include => {:changeset => :user},
:conditions => ["path = ?", path.with_leading_slash],
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit).collect(&:changeset)
changesets.find(:all, :select => "DISTINCT #{Changeset.table_name}.*",
:joins => :changes,
:conditions => ["#{Change.table_name}.path = ? OR #{Change.table_name}.path LIKE ?",
path.with_leading_slash,
"#{path.with_leading_slash.gsub('%', '%%')}/%"],
:include => :user, :limit => limit)
end
end
app/models/repository/subversion.rb
end
def latest_changesets(path, rev, limit=10)
revisions = scm.revisions(path, rev, nil, :limit => limit)
revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : []
path = "#{relative_url}/#{path}".gsub(%r|/+|, '/') unless path.blank?
super(path, rev, limit)
end
# Returns a path relative to the url of the repository
(2-2/9)