Add brew release-notes developer command.

Outputs the merged pull requests on Homebrew/brew between two Git refs.
This commit is contained in:
Mike McQuaid 2016-10-22 12:10:48 +01:00
parent 0296439c83
commit 0c661f5c90
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,43 @@
#: * `release-notes` [<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 `end_ref` is provided it defaults to `origin/master`.
#:
#: If `--markdown` is passed, output as a Markdown list.
module Homebrew
module_function
def release_notes
previous_tag = ARGV.named.first
unless previous_tag
previous_tag = Utils.popen_read("git tag --list --sort=-version:refname")
.lines.first.chomp
end
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
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.map! do |s|
s.gsub(/.*Merge pull request #(\d+)[^>]*(>>)*/,
"https://github.com/Homebrew/brew/pull/\\1")
end
if ARGV.include?("--markdown")
output.map! do |s|
/(.*\d)+ - (.*)/ =~ s
"- [#{$2}](#{$1})"
end
end
puts "Release notes between #{previous_tag} and #{end_ref}:"
puts output
end
end

View File

@ -567,6 +567,11 @@ Each &lt;patch-source> may be one of:
If <code>--no-publish</code> was passed, do not publish bottles to Bintray.</p> If <code>--no-publish</code> was passed, do not publish bottles to Bintray.</p>
<dl> <dl>
<dt><code>release-notes</code> [<var>previous_tag</var>] [<var>end_ref</var>]</dt><dd><p>Output the merged pull requests on Homebrew/brew between two Git refs.
If no <code>previous_tag</code> is provided it defaults to the newest tag.
If no <code>end_ref</code> is provided it defaults to <code>origin/master</code>.</p>
<p>If <code>--markdown</code> is passed, output as a Markdown list.</p></dd>
<dt><code>tap-new</code> <var>user</var><code>/</code><var>repo</var></dt><dd><p>Generate the template files for a new tap.</p></dd> <dt><code>tap-new</code> <var>user</var><code>/</code><var>repo</var></dt><dd><p>Generate the template files for a new tap.</p></dd>
<dt><code>test</code> [<code>--devel</code>|<code>--HEAD</code>] [<code>--debug</code>] [<code>--keep-tmp</code>] <var>formula</var></dt><dd><p>Most formulae provide a test method. <code>brew test</code> <var>formula</var> runs this <dt><code>test</code> [<code>--devel</code>|<code>--HEAD</code>] [<code>--debug</code>] [<code>--keep-tmp</code>] <var>formula</var></dt><dd><p>Most formulae provide a test method. <code>brew test</code> <var>formula</var> runs this
test method. There is no standard output or return code, but it should test method. There is no standard output or return code, but it should

View File

@ -759,6 +759,13 @@ Each <patch\-source> may be one of:
If \fB\-\-bottle\fR was passed, handle bottles, pulling the bottle\-update commit and publishing files on Bintray\. If \fB\-\-bump\fR was passed, for one\-formula PRs, automatically reword commit message to our preferred format\. If \fB\-\-clean\fR was passed, do not rewrite or otherwise modify the commits found in the pulled PR\. If \fB\-\-ignore\-whitespace\fR was passed, silently ignore whitespace discrepancies when applying diffs\. If \fB\-\-resolve\fR was passed, when a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\. If \fB\-\-branch\-okay\fR was passed, do not warn if pulling to a branch besides master (useful for testing)\. If \fB\-\-no\-pbcopy\fR was passed, do not copy anything to the system If \fB\-\-no\-publish\fR was passed, do not publish bottles to Bintray\. If \fB\-\-bottle\fR was passed, handle bottles, pulling the bottle\-update commit and publishing files on Bintray\. If \fB\-\-bump\fR was passed, for one\-formula PRs, automatically reword commit message to our preferred format\. If \fB\-\-clean\fR was passed, do not rewrite or otherwise modify the commits found in the pulled PR\. If \fB\-\-ignore\-whitespace\fR was passed, silently ignore whitespace discrepancies when applying diffs\. If \fB\-\-resolve\fR was passed, when a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\. If \fB\-\-branch\-okay\fR was passed, do not warn if pulling to a branch besides master (useful for testing)\. If \fB\-\-no\-pbcopy\fR was passed, do not copy anything to the system If \fB\-\-no\-publish\fR was passed, do not publish bottles to Bintray\.
. .
.TP .TP
\fBrelease\-notes\fR [\fIprevious_tag\fR] [\fIend_ref\fR]
Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fBprevious_tag\fR is provided it defaults to the newest tag\. If no \fBend_ref\fR is provided it defaults to \fBorigin/master\fR\.
.
.IP
If \fB\-\-markdown\fR is passed, output as a Markdown list\.
.
.TP
\fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR \fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR
Generate the template files for a new tap\. Generate the template files for a new tap\.
. .