Skip to content

Instantly share code, notes, and snippets.

@rhaamo
Created August 10, 2011 13:49
Show Gist options
  • Save rhaamo/1136841 to your computer and use it in GitHub Desktop.
Save rhaamo/1136841 to your computer and use it in GitHub Desktop.
# coding: utf-8
require "rubygems"
require "grit"
#require "ruby-debug" ; Debugger.start
include Grit
Grit::Git.git_timeout = 600 # 10.minutes
Grit::Git.git_max_size = 83886080 # 80.megabytes
Grit.debug = true
#repo = "/home/marc/src/linux-2.6.38.y"
#repo = ARGV[0]
repo = "/home/marc/linux-3.0.y"
grit_repo = Repo.new(repo)
branches = grit_repo.branches
commits_count = grit_repo.commit_count("master")
#begin
count=0
while (count < commits_count)
commits = grit_repo.commits("master", 10, count)
commits.each do |c|
puts "COMMITS COMMITS COMMITS COMMITS !"
useless_commit = [c.id, c.message, c.author.name, c.committed_date]
c.diffs.each do |c_diff| # <====
puts "DIFF !!!" # <
# a_file = nil # < Causes memory leaks
# a_file = [c_diff.b_path.split("/").last, c_diff.b_path] # <
end # <====
end
diff_c = commits_count - count
if (diff_c > 10)
count += 10
else
count += diff_c
end
end
#rescue Grit::Git::GitTimeout => e
# puts e
# puts "Repository: #{repo}"
# puts "Branches: #{branches}"
# puts "Commits: #{commits_count}"
# puts "Foo: #{foo}"
#end
puts "FINISH --------------------"
puts "Repository: #{repo}"
puts "Branches: #{branches}"
puts "Commits: #{commits_count}"
puts "Foo: #{foo}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment