Skip to content

Commit

Permalink
Release notes handle specifying one tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonnoble committed Mar 31, 2009
1 parent 9f9cfba commit 406a03a
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions lib/git/release_notes.rb
Expand Up @@ -8,19 +8,35 @@ def annotate!
tags = get_tags.reverse

start_tag = ask "Start at which tag?", tags[0], tags
end_tag = ask "End at which tag?", tags[1], tags
end_tag = ask "End at which tag?", tags[1] || tags[0], tags
end_index = tags.index(end_tag) + 1 # include end tag
start_index = tags.index(start_tag)
puts
tags_to_log = tags[start_index..end_index]

tags[start_index..end_index].each_cons(2) do |start, finish|
log = `git log --pretty=format:"%h %s" refs/tags/#{finish}..refs/tags/#{start}`.strip
next if log.empty?
puts "#{start}"
puts "=" * start.length
puts log.split("\n").reject{|line| line.include?("Merge branch 'master' into qa_branch")}
puts
puts
if tags_to_log.size == 1
tag = tags_to_log.first
print_tag_header(tag)
puts tag_log(tag)
else
tags_to_log.each_cons(2) do |start, finish|
log = tag_log(finish, start)
next if log.empty?
print_tag_header(start)
end
end
puts
end

private

def print_tag_header(tag)
puts tag
puts "=" * tag.length
end

def tag_log(finish, start=nil)
`git log --no-merges --pretty=format:"%h %s" refs/tags/#{finish}#{'..refs/tags/' + start if start}`.strip
end
end
end

0 comments on commit 406a03a

Please sign in to comment.