Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. # simple rake task to output a changelog between two commits, tags ...
  2. # output is formatted simply, commits are grouped under each author name
  3. #
  4. desc "generate changelog with nice clean output"
  5. task :changelog, :since_c, :until_c do |t,args|
  6. since_c = args[:since_c] || `git tag | head -1`.chomp
  7. until_c = args[:until_c]
  8. cmd=`git log --pretty='format:%ci::%an <%ae>::%s::%H' --after=#{since_c} --before=#{until_c}`
  9.  
  10. entries = Hash.new
  11. changelog_content = String.new
  12.  
  13. cmd.split("\n").each do |entry|
  14. date, author, subject, hash = entry.chomp.split("::")
  15. entries[author] = Array.new unless entries[author]
  16. day = date.split(" ").first
  17. entries[author] << "#{subject} (#{hash})" unless subject =~ /Merge/
  18. end
  19.  
  20. # generate clean output
  21. entries.keys.each do |author|
  22. changelog_content += author + "\n"
  23. entries[author].reverse.each { |entry| changelog_content += " * #{entry}\n" }
  24. end
  25.  
  26. puts changelog_content
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement