Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for Git

requires FasterCSV, run in your source directory

Git
2007 year 11 month 27 day Tuesday 20:40:11 MDT 

  1. require 'fastercsv'
  2.  
  3. h = Hash.new
  4. linen = 0
  5. dategroup = Date.new
  6. #.select{ |l| l =~ /[a-zA-Z0-9]+/ }
  7. `git log --pretty=format:%aD --shortstat | grep [a-zA-Z0-9]`.each { |line|
  8.         if line =~ /\d\d:\d\d:\d\d/ then
  9.                 date = Date.parse(line)
  10.                 dategroup = Date.new(date.year, date.month, 1)
  11.                 if h[dategroup] then
  12.                         h[dategroup][:commits] += 1
  13.                 else
  14.                         h[dategroup] = Hash.new
  15.                         h[dategroup][:commits] = 1
  16.                 end
  17.         else
  18.                 line =~ /([\d]+) files changed, ([\d]+) insertions\(\+\), ([\d]+) deletions\(-\)/
  19.                 h[dategroup][:insert] = (h[dategroup][:insert])? h[dategroup][:insert].to_i + $2.to_i : $2.to_i
  20.                 h[dategroup][:delete] = (h[dategroup][:delete])? h[dategroup][:delete].to_i + $3.to_i : $3.to_i
  21.         end
  22. }
  23.  
  24. FasterCSV.open("/tmp/count.csv", "w") do |csv|
  25.         h.sort.each { |date, value|
  26.                 csv << [ "#{date.month}/1/#{date.year}", value[:commits], value[:insert] + value[:delete] ]
  27.         }
  28. end

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right