##// END OF EJS Templates
scm: code clean up repository model....
Toshi MARUYAMA -
r5533:fbdbdf96fe91
parent child
Show More
@@ -1,5 +1,5
1 # redMine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
@@ -146,14 +146,19 class Repository < ActiveRecord::Base
146 # Default behaviour is to search in cached changesets
146 # Default behaviour is to search in cached changesets
147 def latest_changesets(path, rev, limit=10)
147 def latest_changesets(path, rev, limit=10)
148 if path.blank?
148 if path.blank?
149 changesets.find(:all, :include => :user,
149 changesets.find(
150 :all,
151 :include => :user,
150 :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
152 :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
151 :limit => limit)
153 :limit => limit)
152 else
154 else
153 changes.find(:all, :include => {:changeset => :user},
155 changes.find(
156 :all,
157 :include => {:changeset => :user},
154 :conditions => ["path = ?", path.with_leading_slash],
158 :conditions => ["path = ?", path.with_leading_slash],
155 :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
159 :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
156 :limit => limit).collect(&:changeset)
160 :limit => limit
161 ).collect(&:changeset)
157 end
162 end
158 end
163 end
159
164
General Comments 0
You need to be logged in to leave comments. Login now