public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
commits-by-author graph should use gitorious username (if found)

Signed-off-by: David A. Cuadrado <krawek@gmail.com>
David A. Cuadrado (author)
Tue Apr 29 13:45:17 -0700 2008
commit  4b96998f3b5c19a84ac69d9a4ace5ca2d8c6e1ae
tree    17ed215d99ea46e146c10b9c80d4c456a183d5bd
parent  02cf241ab283410162f479ebccd686c60ef6bdc6
...
180
181
182
183
184
 
 
 
185
186
187
188
 
189
190
191
 
 
192
193
194
 
 
 
 
 
 
195
196
197
...
180
181
182
 
 
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
0
@@ -180,18 +180,28 @@ class Repository < ActiveRecord::Base
0
   # TODO: caching
0
   def commit_graph_data_by_author(head = "master")
0
     h = {}
0
- count_author_regexp = /^\s+(\d+)\s(.+)$/.freeze
0
- data = self.git.git.shortlog({:s => true }, head)
0
+ emails = {}
0
+ count_author_regexp = /^\s+(\d+)\s(.+)\s\<(\S+)\>$/.freeze
0
+ data = self.git.git.shortlog({:e => true, :s => true }, head)
0
     data.each_line do |line|
0
       if line =~ count_author_regexp
0
         count = $1.to_i
0
         author = $2
0
+ email = $3
0
         
0
         h[author] ||= 0
0
         h[author] += count
0
+
0
+ emails[email] = author
0
       end
0
     end
0
     
0
+ users = User.find(:all, :conditions => ["email in (?)", emails.keys])
0
+ users.each do |user|
0
+ author_name = emails[user.email]
0
+ h[user.login] = h.delete(author_name)
0
+ end
0
+
0
     h
0
   end
0
   

Comments

    No one has commented yet.