Make release-notes command work from any location
* specify repository location using `-C` option * change `newest` to `latest` when talking about the latest tagged commit
This commit is contained in:
parent
468210840c
commit
40b0d0b584
@ -1,6 +1,6 @@
|
|||||||
#: * `release-notes` [`--markdown`] [<previous_tag>] [<end_ref>]:
|
#: * `release-notes` [`--markdown`] [<previous_tag>] [<end_ref>]:
|
||||||
#: Output the merged pull requests on Homebrew/brew between two Git refs.
|
#: Output the merged pull requests on Homebrew/brew between two Git refs.
|
||||||
#: If no <previous_tag> is provided it defaults to the newest tag.
|
#: If no <previous_tag> is provided it defaults to the latest tag.
|
||||||
#: If no <end_ref> is provided it defaults to `origin/master`.
|
#: If no <end_ref> is provided it defaults to `origin/master`.
|
||||||
#:
|
#:
|
||||||
#: If `--markdown` is passed, output as a Markdown list.
|
#: If `--markdown` is passed, output as a Markdown list.
|
||||||
@ -16,19 +16,21 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
previous_tag = ARGV.named.first
|
previous_tag = ARGV.named.first
|
||||||
previous_tag ||= Utils.popen_read("git tag --list --sort=-version:refname")
|
previous_tag ||= Utils.popen_read(
|
||||||
.lines.first.chomp
|
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
|
||||||
|
).lines.first.chomp
|
||||||
odie "Could not find any previous tags!" unless previous_tag
|
odie "Could not find any previous tags!" unless previous_tag
|
||||||
|
|
||||||
end_ref = ARGV.named[1] || "origin/master"
|
end_ref = ARGV.named[1] || "origin/master"
|
||||||
|
|
||||||
[previous_tag, end_ref].each do |ref|
|
[previous_tag, end_ref].each do |ref|
|
||||||
next if quiet_system "git", "rev-parse", "--verify", "--quiet", ref
|
next if quiet_system "git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--verify", "--quiet", ref
|
||||||
odie "Ref #{ref} does not exist!"
|
odie "Ref #{ref} does not exist!"
|
||||||
end
|
end
|
||||||
|
|
||||||
output = Utils.popen_read("git log --pretty=format:'%s >> - %b%n' '#{previous_tag}'..'#{end_ref}'")
|
output = Utils.popen_read(
|
||||||
.lines.grep(/Merge pull request/)
|
"git", "-C", HOMEBREW_REPOSITORY, "log", "--pretty=format:'%s >> - %b%n'", "#{previous_tag}..#{end_ref}"
|
||||||
|
).lines.grep(/Merge pull request/)
|
||||||
|
|
||||||
output.map! do |s|
|
output.map! do |s|
|
||||||
s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
|
s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user