Want a list of the users and the number of commits they made? Git makes it really really easy, while I could not find such an easy method on Subversion. Here they are.
Git
git log | git shortlog -n -s
Subversion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#!/usr/bin/env ruby require 'rubygems' require 'activesupport' log_xml = `svn log -q --xml` svn_logs = XmlSimple.xml_in(log_xml)['logentry'] report_hash = svn_logs.inject({}) do |report,log| author = log['author'][0] report[author] ||= {:commit_count => 0} report[author][:commit_count] += 1 report end commits_authors = report_hash.keys.map { |a| [report_hash[a][:commit_count], a] } commits_authors = commits_authors.sort_by(&:first).reverse cc_colsize = commits_authors.map(&:first).max.to_s.size a_colsize = commits_authors.map(&:last).inject{|m,w| m.length > w.length ? m : w }.size final_report = commits_authors.map do |ca| c,a = ca " #{c.to_s.rjust(cc_colsize)} #{a.ljust(a_colsize)}" end.join("\n") puts final_report |








