Commit 4b96998f3b5c19a84ac69d9a4ace5ca2d8c6e1ae

commits-by-author graph should use gitorious username (if found)

Signed-off-by: David A. Cuadrado <krawek@gmail.com>

Commit diff

app/models/repository.rb

 
180180 # TODO: caching
181181 def commit_graph_data_by_author(head = "master")
182182 h = {}
183 count_author_regexp = /^\s+(\d+)\s(.+)$/.freeze
184 data = self.git.git.shortlog({:s => true }, head)
183 emails = {}
184 count_author_regexp = /^\s+(\d+)\s(.+)\s\<(\S+)\>$/.freeze
185 data = self.git.git.shortlog({:e => true, :s => true }, head)
185186 data.each_line do |line|
186187 if line =~ count_author_regexp
187188 count = $1.to_i
188189 author = $2
190 email = $3
189191
190192 h[author] ||= 0
191193 h[author] += count
194
195 emails[email] = author
192196 end
193197 end
194198
199 users = User.find(:all, :conditions => ["email in (?)", emails.keys])
200 users.each do |user|
201 author_name = emails[user.email]
202 h[user.login] = h.delete(author_name)
203 end
204
195205 h
196206 end
197207
toggle raw diff