Merge pull request #4050 from maxim-belkin/fix-release-notes

Make release-notes command work from any location
This commit is contained in:
Mike McQuaid 2018-04-10 11:41:47 -07:00 committed by GitHub
commit df19f7103c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View File

@ -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 ([^/]+)/[^>]*(>>)*},

View File

@ -850,7 +850,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
* `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.

View File

@ -868,7 +868,7 @@ If \fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR is passed, pull the bottle bl
. .
.TP .TP
\fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR] \fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]
Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the newest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\.
. .
.IP .IP
If \fB\-\-markdown\fR is passed, output as a Markdown list\. If \fB\-\-markdown\fR is passed, output as a Markdown list\.