bump-formula-pr: add --message option

For user-supplied PR message.
This commit is contained in:
Zhiming Wang 2016-11-15 11:37:49 -05:00
parent f4f90cad75
commit 67999d75f5
No known key found for this signature in database
GPG Key ID: BBD31D4D110044B8
3 changed files with 30 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] `--url=`<url> `--sha256=`<sha-256> <formula>: #: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] [`--message=`<message>] `--url=`<url> `--sha256=`<sha-256> <formula>:
#: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] `--tag=`<tag> `--revision=`<revision> <formula>: #: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] [`--message=`<message>] `--tag=`<tag> `--revision=`<revision> <formula>:
#: Creates a pull request to update the formula with a new url or a new tag. #: Creates a pull request to update the formula with a new url or a new tag.
#: #:
#: If a <url> is specified, the <sha-256> checksum of the new download must #: If a <url> is specified, the <sha-256> checksum of the new download must
@ -27,6 +27,9 @@
#: parsed from the url or tag. Note that `--version=0` can be used to delete #: parsed from the url or tag. Note that `--version=0` can be used to delete
#: an existing `version` override from a formula if it has become redundant. #: an existing `version` override from a formula if it has become redundant.
#: #:
#: If `--message=`<message> is passed, append <message> to the default PR
#: message.
#:
#: Note that this command cannot be used to transition a formula from a #: Note that this command cannot be used to transition a formula from a
#: url-and-sha256 style specification into a tag-and-revision style #: url-and-sha256 style specification into a tag-and-revision style
#: specification, nor vice versa. It must use whichever style specification #: specification, nor vice versa. It must use whichever style specification
@ -259,8 +262,21 @@ module Homebrew
remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1] remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
odie "cannot get remote from 'hub'!" if remote.to_s.empty? odie "cannot get remote from 'hub'!" if remote.to_s.empty?
safe_system "git", "push", "--set-upstream", remote, "#{branch}:#{branch}" safe_system "git", "push", "--set-upstream", remote, "#{branch}:#{branch}"
safe_system "hub", "pull-request", "--browse", "-m", pr_message = <<-EOS.undent
"#{formula.name} #{new_formula_version}#{devel_message}\n\nCreated with `brew bump-formula-pr`." #{formula.name} #{new_formula_version}#{devel_message}
Created with `brew bump-formula-pr`.
EOS
user_message = ARGV.value("message")
if user_message
pr_message += <<-EOS.undent
---
#{user_message}
EOS
end
safe_system "hub", "pull-request", "--browse", "-m", pr_message
safe_system "git", "checkout", "-" safe_system "git", "checkout", "-"
end end
end end

View File

@ -469,8 +469,8 @@ for instance, for implementing pre-commit hooks.</p></dd>
<p>Generate a bottle (binary package) from a formula installed with <p>Generate a bottle (binary package) from a formula installed with
<code>--build-bottle</code>.</p></dd> <code>--build-bottle</code>.</p></dd>
<dt><code>bump-formula-pr</code> [<code>--devel</code>] [<code>--dry-run</code>] [<code>--audit</code>|<code>--strict</code>] <code>--url=</code><var>url</var> <code>--sha256=</code><var>sha-256</var> <var>formula</var>:</dt><dd><p></p></dd> <dt><code>bump-formula-pr</code> [<code>--devel</code>] [<code>--dry-run</code>] [<code>--audit</code>|<code>--strict</code>] [<code>--message=</code><var>message</var>] <code>--url=</code><var>url</var> <code>--sha256=</code><var>sha-256</var> <var>formula</var>:</dt><dd><p></p></dd>
<dt><code>bump-formula-pr</code> [<code>--devel</code>] [<code>--dry-run</code>] [<code>--audit</code>|<code>--strict</code>] <code>--tag=</code><var>tag</var> <code>--revision=</code><var>revision</var> <var>formula</var></dt><dd><p>Creates a pull request to update the formula with a new url or a new tag.</p> <dt><code>bump-formula-pr</code> [<code>--devel</code>] [<code>--dry-run</code>] [<code>--audit</code>|<code>--strict</code>] [<code>--message=</code><var>message</var>] <code>--tag=</code><var>tag</var> <code>--revision=</code><var>revision</var> <var>formula</var></dt><dd><p>Creates a pull request to update the formula with a new url or a new tag.</p>
<p>If a <var>url</var> is specified, the <var>sha-256</var> checksum of the new download must <p>If a <var>url</var> is specified, the <var>sha-256</var> checksum of the new download must
also be specified. A best effort to determine the <var>sha-256</var> and <var>formula</var> also be specified. A best effort to determine the <var>sha-256</var> and <var>formula</var>
@ -497,6 +497,9 @@ making the expected file modifications but not taking any git actions.</p>
parsed from the url or tag. Note that <code>--version=0</code> can be used to delete parsed from the url or tag. Note that <code>--version=0</code> can be used to delete
an existing <code>version</code> override from a formula if it has become redundant.</p> an existing <code>version</code> override from a formula if it has become redundant.</p>
<p>If <code>--message=</code><var>message</var> is passed, append <var>message</var> to the default PR
message.</p>
<p>Note that this command cannot be used to transition a formula from a <p>Note that this command cannot be used to transition a formula from a
url-and-sha256 style specification into a tag-and-revision style url-and-sha256 style specification into a tag-and-revision style
specification, nor vice versa. It must use whichever style specification specification, nor vice versa. It must use whichever style specification

View File

@ -654,11 +654,11 @@ If \fB\-\-display\-filename\fR is passed, every line of output is prefixed with
Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\.
. .
.TP .TP
\fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] \fB\-\-url=\fR\fIurl\fR \fB\-\-sha256=\fR\fIsha\-256\fR \fIformula\fR: \fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] [\fB\-\-message=\fR\fImessage\fR] \fB\-\-url=\fR\fIurl\fR \fB\-\-sha256=\fR\fIsha\-256\fR \fIformula\fR:
. .
.TP .TP
\fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] \fB\-\-tag=\fR\fItag\fR \fB\-\-revision=\fR\fIrevision\fR \fIformula\fR \fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] [\fB\-\-message=\fR\fImessage\fR] \fB\-\-tag=\fR\fItag\fR \fB\-\-revision=\fR\fIrevision\fR \fIformula\fR
Creates a pull request to update the formula with a new url or a new tag\. Creates a pull request to update the formula with a new url or a new tag\.
. .
.IP .IP
@ -689,6 +689,9 @@ If \fB\-\-mirror=\fR\fIurl\fR is passed, use the value as a mirror url\.
If \fB\-\-version=\fR\fIversion\fR is passed, use the value to override the value parsed from the url or tag\. Note that \fB\-\-version=0\fR can be used to delete an existing \fBversion\fR override from a formula if it has become redundant\. If \fB\-\-version=\fR\fIversion\fR is passed, use the value to override the value parsed from the url or tag\. Note that \fB\-\-version=0\fR can be used to delete an existing \fBversion\fR override from a formula if it has become redundant\.
. .
.IP .IP
If \fB\-\-message=\fR\fImessage\fR is passed, append \fImessage\fR to the default PR message\.
.
.IP
Note that this command cannot be used to transition a formula from a url\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. Note that this command cannot be used to transition a formula from a url\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\.
. .
.TP .TP