Skip to content

Instantly share code, notes, and snippets.

@dchentech
Created December 19, 2014 06:50
Show Gist options
  • Save dchentech/b8b0390449367ad41743 to your computer and use it in GitHub Desktop.
Save dchentech/b8b0390449367ad41743 to your computer and use it in GitHub Desktop.
用 Ruby 简单 统计 hg 每日 commit 量。
`hg log --template 'date: {date|isodate}\n' | grep 'date: '`.split("\n").map {|i1| i1[6..15] }.inject({}) {|d1, i1| d1[i1] ||= 0; d1[i1] += 1; d1 }.sort {|a, b| a[0] <=> b[0] }.each {|i| puts i.inspect };0
__END__
["2014-09-24", 4]
["2014-09-25", 8]
["2014-09-26", 6]
["2014-09-28", 10]
["2014-09-29", 14]
["2014-09-30", 3]
["2014-10-08", 14]
["2014-10-09", 8]
["2014-10-10", 18]
["2014-10-11", 13]
["2014-10-13", 25]
["2014-10-14", 16]
["2014-10-15", 18]
["2014-10-16", 14]
["2014-10-17", 27]
["2014-10-20", 11]
["2014-10-21", 11]
["2014-10-22", 2]
["2014-10-23", 6]
["2014-10-24", 13]
["2014-10-27", 9]
["2014-10-28", 3]
["2014-10-29", 7]
["2014-10-30", 2]
["2014-11-03", 2]
["2014-11-04", 1]
["2014-11-05", 2]
["2014-11-06", 1]
["2014-11-07", 13]
["2014-11-10", 10]
["2014-11-11", 10]
["2014-11-12", 14]
["2014-11-13", 13]
["2014-11-17", 22]
["2014-11-18", 42]
["2014-11-19", 46]
["2014-11-20", 22]
["2014-11-21", 16]
["2014-11-24", 11]
["2014-11-25", 9]
["2014-11-26", 10]
["2014-11-27", 12]
["2014-11-28", 21]
["2014-12-01", 16]
["2014-12-02", 21]
["2014-12-03", 17]
["2014-12-04", 13]
["2014-12-05", 30]
["2014-12-08", 9]
["2014-12-09", 15]
["2014-12-10", 12]
["2014-12-11", 18]
["2014-12-12", 13]
["2014-12-15", 14]
["2014-12-16", 18]
["2014-12-17", 25]
["2014-12-18", 20]
["2014-12-19", 7]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment