##// END OF EJS Templates
code format clean up Repository::Git model...
Toshi MARUYAMA -
r12467:857494861736
parent child
Show More
@@ -180,10 +180,13 class Repository::Git < Repository
180 # So, Redmine needs to scan revisions and database every time.
180 # So, Redmine needs to scan revisions and database every time.
181 #
181 #
182 # This is replacing the one-after-one queries.
182 # This is replacing the one-after-one queries.
183 # Find all revisions, that are in the database, and then remove them from the revision array.
183 # Find all revisions, that are in the database, and then remove them
184 # from the revision array.
184 # Then later we won't need any conditions for db existence.
185 # Then later we won't need any conditions for db existence.
185 # Query for several revisions at once, and remove them from the revisions array, if they are there.
186 # Query for several revisions at once, and remove them
186 # Do this in chunks, to avoid eventual memory problems (in case of tens of thousands of commits).
187 # from the revisions array, if they are there.
188 # Do this in chunks, to avoid eventual memory problems
189 # (in case of tens of thousands of commits).
187 # If there are no revisions (because the original code's algorithm filtered them),
190 # If there are no revisions (because the original code's algorithm filtered them),
188 # then this part will be stepped over.
191 # then this part will be stepped over.
189 # We make queries, just if there is any revision.
192 # We make queries, just if there is any revision.
@@ -198,7 +201,6 class Repository::Git < Repository
198 revisions.reject!{|r| recent_revisions.include?(r.scmid)}
201 revisions.reject!{|r| recent_revisions.include?(r.scmid)}
199 offset += limit
202 offset += limit
200 end
203 end
201
202 revisions.each do |rev|
204 revisions.each do |rev|
203 transaction do
205 transaction do
204 # There is no search in the db for this revision, because above we ensured,
206 # There is no search in the db for this revision, because above we ensured,
@@ -240,7 +242,6 class Repository::Git < Repository
240 def latest_changesets(path,rev,limit=10)
242 def latest_changesets(path,rev,limit=10)
241 revisions = scm.revisions(path, nil, rev, :limit => limit, :all => false)
243 revisions = scm.revisions(path, nil, rev, :limit => limit, :all => false)
242 return [] if revisions.nil? || revisions.empty?
244 return [] if revisions.nil? || revisions.empty?
243
244 changesets.where(:scmid => revisions.map {|c| c.scmid}).all
245 changesets.where(:scmid => revisions.map {|c| c.scmid}).all
245 end
246 end
246
247
General Comments 0
You need to be logged in to leave comments. Login now