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>]:
|
||||
#: 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 `--markdown` is passed, output as a Markdown list.
|
||||
@ -16,19 +16,21 @@ module Homebrew
|
||||
end
|
||||
|
||||
previous_tag = ARGV.named.first
|
||||
previous_tag ||= Utils.popen_read("git tag --list --sort=-version:refname")
|
||||
.lines.first.chomp
|
||||
previous_tag ||= Utils.popen_read(
|
||||
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
|
||||
).lines.first.chomp
|
||||
odie "Could not find any previous tags!" unless previous_tag
|
||||
|
||||
end_ref = ARGV.named[1] || "origin/master"
|
||||
|
||||
[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!"
|
||||
end
|
||||
|
||||
output = Utils.popen_read("git log --pretty=format:'%s >> - %b%n' '#{previous_tag}'..'#{end_ref}'")
|
||||
.lines.grep(/Merge pull request/)
|
||||
output = Utils.popen_read(
|
||||
"git", "-C", HOMEBREW_REPOSITORY, "log", "--pretty=format:'%s >> - %b%n'", "#{previous_tag}..#{end_ref}"
|
||||
).lines.grep(/Merge pull request/)
|
||||
|
||||
output.map! do |s|
|
||||
s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user