diff options
| -rw-r--r-- | Library/Homebrew/dev-cmd/release-notes.rb | 43 | ||||
| -rw-r--r-- | docs/brew.1.html | 5 | ||||
| -rw-r--r-- | manpages/brew.1 | 7 | 
3 files changed, 55 insertions, 0 deletions
| diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb new file mode 100644 index 000000000..919243764 --- /dev/null +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -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 diff --git a/docs/brew.1.html b/docs/brew.1.html index 59c29cb3a..bb8775ceb 100644 --- a/docs/brew.1.html +++ b/docs/brew.1.html @@ -567,6 +567,11 @@ Each <patch-source> may be one of:     If <code>--no-publish</code> was passed, do not publish bottles to Bintray.</p>  <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>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 diff --git a/manpages/brew.1 b/manpages/brew.1 index ca98390a6..c74969aee 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\.  .  .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  Generate the template files for a new tap\.  . | 
