4 $dates=(Date.parse($first_date)..(Date.today-1)).map { |d| d.to_s }
5 $git_dir = File.join $stats_dir, "proj"
10 $revisions, all, min = {}, {}, Time.parse($first_date)
12 `git log --pretty=format:"%ci: %H"`.each do |line|
13 time, hash = line.split(/: /)
14 raise "line = #{line}" unless time and hash
15 time = Time.parse(time).utc
20 all.sort.each do |time, hash|
21 key = time.strftime("%Y-%m-%d")
22 next if $revisions.has_key? key
23 $revisions[key] = hash
29 $revisions[date] ||= backfill
30 backfill = $revisions[date]
37 def git_task type, &block
38 task :collect => $dates.map { |date| File.join $stats_dir, "#{date}.#{type}" }
40 rule ".#{type}" do |t|
42 date = file[/\d\d\d\d-\d\d-\d\d/]
43 hash = git_revisions[date]
44 File.open file, 'w' do |f|
47 sh "git checkout -q #{hash}"