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年 11月 27日 火曜日 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

ポストを更新

このポストは更新できる、または、新しいポストを作成

You may also comment on this post.

ペーストの更新
ポストの詳細 (随意)

注目: ペーストのコンテントだけで必要ですが、以下の情報は便利かも知れません。

名前/タイトルを保存する?

(スペースで切る, 随意)



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
fantasy-obligation