Skip to content

Instantly share code, notes, and snippets.

@bradly
Created June 17, 2009 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bradly/131357 to your computer and use it in GitHub Desktop.
Save bradly/131357 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'nokogiri'
AUTHOR = 'Bradly Feeley'
PROJECT_PATH = '~/www/digitaria-ddp/'
commit_format = "<commit id='%h' date='%ct' author='%an'>%n %s%n</commit>%n%n"
xml = '<commits>'
xml += `cd #{PROJECT_PATH} && git log --all --author='#{AUTHOR}' --pretty=format:"#{commit_format}"`
xml += '</commits>'
doc = Nokogiri::XML.parse(xml)
commits = doc.search('* commit').collect do |commit|
{
:id => commit['id'],
:date => Date.parse(Time.at(commit['date'].to_i).strftime('%Y/%m/%d')),
:author => commit['author'],
:message => commit.content.strip
}
end
commits.delete_if { |c| c[:message] =~ /^Merge branch/ }
dates = commits.collect { |c| c[:date] }.uniq.reverse
dates.each do |date|
current_commits = commits.select { |c| c[:date] == date }
puts date
puts current_commits.reverse.collect { |c| c[:message] }.join("\n")
puts "\n----------------------------\n\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment