Posted By

felipec on 05/16/08


Tagged

ruby git


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

sergeizen
georg
webstic


Ruby git changelog


 / Published in: Ruby
 

Generates a ChangeLog from git repository.

  1. #!/usr/bin/env ruby
  2.  
  3. cmd=`git-log --pretty='format:%ci::%an <%ae>::%s'`
  4.  
  5. list = {}
  6. list_order = []
  7.  
  8. cmd.each do |l|
  9. date, author, subject = l.chomp.split("::")
  10. date, time, zone = date.split(" ")
  11.  
  12. id = "#{date}\t#{author}"
  13. if not list[id]
  14. list[id] = []
  15. list_order << {:id => id, :value => list[id]}
  16. end
  17. list[id] << subject
  18. end
  19.  
  20. # list.each do |id, value|
  21. list_order.each do |i|
  22. id = i[:id]
  23. value = i[:value]
  24.  
  25. puts "#{id}"
  26. puts value.map { |e| "\t* #{e}" }.join("\n")
  27. puts "\n"
  28. end

Report this snippet  

You need to login to post a comment.