##// END OF EJS Templates
Memorize commit authors to speed up changesets loading....
Jean-Philippe Lang -
r3358:3d393a5711f6
parent child
Show More
@@ -136,6 +136,7 class Repository < ActiveRecord::Base
136 end
136 end
137 end
137 end
138 @committers = nil
138 @committers = nil
139 @found_committer_users = nil
139 true
140 true
140 else
141 else
141 false
142 false
@@ -146,16 +147,22 class Repository < ActiveRecord::Base
146 # It will return nil if the committer is not yet mapped and if no User
147 # It will return nil if the committer is not yet mapped and if no User
147 # with the same username or email was found
148 # with the same username or email was found
148 def find_committer_user(committer)
149 def find_committer_user(committer)
149 if committer
150 unless committer.blank?
151 @found_committer_users ||= {}
152 return @found_committer_users[committer] if @found_committer_users.has_key?(committer)
153
154 user = nil
150 c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user)
155 c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user)
151 if c && c.user
156 if c && c.user
152 c.user
157 user = c.user
153 elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
158 elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
154 username, email = $1.strip, $3
159 username, email = $1.strip, $3
155 u = User.find_by_login(username)
160 u = User.find_by_login(username)
156 u ||= User.find_by_mail(email) unless email.blank?
161 u ||= User.find_by_mail(email) unless email.blank?
157 u
162 user = u
158 end
163 end
164 @found_committer_users[committer] = user
165 user
159 end
166 end
160 end
167 end
161
168
General Comments 0
You need to be logged in to leave comments. Login now