243 Commits

Author SHA1 Message Date
Mike McQuaid
e88fd4a868 bump-formula-pr: always use HOMEBREW_PATH.
Fixes this when using environment filtering.
2017-10-28 21:46:30 +01:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
ilovezfs
feda0242be bump-formula-pr: fix duplicates check
`return unless pull_requests && !pull_requests.empty?` and
`return unless pull_requests&.empty?` are not equivalent.
2017-09-25 23:03:19 -07:00
Mike McQuaid
cf5fdeef1d Rubocop: manual rule fixes. 2017-09-24 21:23:59 +01:00
Mike McQuaid
01e9ec9a9f Rubocop: automatic rule fixes. 2017-09-24 21:23:59 +01:00
Mislav Marohnić
80ae5b2660 bump-formula-pr: forward compatibility with hub fork
Due to limitations of `hub fork` in hub 2.2, scripts had to repeat the
command at least two times; the 2nd time was to read the fork name from
the "fatal: remote MYNAME already exists" message output from git.

In upcoming hub 2.3, the `hub fork` command is improved to always output
the remote name, regardless of whether one already existed or not. With
this approach, only one `hub fork` call will ever be necessary when hub
is up to date.
2017-08-15 17:32:12 +02:00
Bob W. Hogg
0ae22c0e36 dev-cmd/bump-formula-pr: search for tar
We first search for gtar in PATH, then
check if Homebrew's gtar is available,
then finally search for tar in PATH.

Signed-off-by: Bob W. Hogg <rwhogg@linux.com>
2017-08-08 23:07:27 -07:00
Mislav Marohnić
f8ec2332a2 Strip trailing newline 2017-06-29 13:28:55 +02:00
Mislav Marohnić
3701b11e42 Fix unshallowing taps in bump-formula-pr
Never try to unhshallow full clones.
2017-06-27 23:45:57 +02:00
Mislav Marohnić
b3ef9ccb8a Fix bump-formula-pr when working with a shallow git clone
Creating a fork and pushing to it doesn't work when the repository in
question is a shallow clone. By default, Homebrew clones all taps in
shallow mode unless `--full` was passed or $HOMEBREW_DEVELOPER was set.
2017-06-27 14:32:09 +02:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
ilovezfs
baf7ba6316 bump-formula-pr: check for version presence.
If it's not there, error out rather than fetching to avoid creating
versionless cache files, which cause `brew cleanup` to crash.
2017-03-01 04:25:10 -08:00
EricFromCanada
afc539f86e Update brew's man page formatting and grammar
Also update command specifications to match descriptions.
2017-02-25 17:37:57 -05:00
Zhiming Wang
81a7609213
bump-formula-pr: improve duplicate detection
Reduce the chance of false flagging by making sure that the existing pr
surfaced by GitHub.issues_for_formula actually contains the exact formula name
in its title.
2017-02-20 10:36:24 -05:00
ilovezfs
539120143b bump-formula-pr: block duplicate pull-requests 2017-02-12 10:36:24 -08:00
Mike McQuaid
c276a44eba bump-formula-pr: check for URL presence.
If it's not there, produce a nicer error.

Fixes #1805.
2017-01-09 12:16:55 +00:00
Zhiming Wang
3ebd7df62d
bump-formula-pr: fix removal of old mirrors
Previously, old mirrors are only removed if the requested spec is
stable, and if the mirror lines only have two leading spaces. This leads
to stale mirror line(s) when the formula a stable block like

    stable do
      url "http://example.com/v1.0.tar.gz"
      mirror "http://example.net/v1.0.tar.gz"
    end

where the mirror line is lead by four spaces.

In this commit, we discard the /(^ mirror .*\n)?/ pattern, and instead
create a pattern with the exact url and flexible leading spaces for each
mirror of the requested spec.
2016-12-22 00:54:08 -05:00
Zhiming Wang
417f27f40f
bump-formula-pr: use correct version in download
When a --version is specified, use this specified version in the name of
the downloaded file rather than the default that is parsed from the URL.
For instance,

  brew bump-formula-pr --devel \
    --url=http://www.zsh.org/pub/development/zsh-5.2-test-2.tar.gz \
    --version=5.2-test-2 zsh

should download to $HOMEBREW_CACHE/zsh-5.2-test-2.tar.gz (correct
behavior after this commit) rather than
$HOMEBREW_CACHE/zsh-2.tar.gz (wrong behavior before this commit).
2016-12-06 17:30:10 -05:00
Zhiming Wang
67999d75f5
bump-formula-pr: add --message option
For user-supplied PR message.
2016-11-17 15:29:33 -05:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
ilovezfs
3811f57006 bump-formula-pr: document new options 2016-09-27 03:31:05 -07:00
ilovezfs
5247cb83d7 bump-formula-pr: style fixes 2016-09-27 03:31:04 -07:00
ilovezfs
ff51e09e17 bump-formula-pr: forced_version support for devel 2016-09-27 02:50:46 -07:00
ilovezfs
f4cfb9ee87 bump-formula-pr: add --write option
intended to be used in combination with --dry-run for a not-so-dry run

the expected file modifications are made, but no git actions are taken
2016-09-27 02:46:08 -07:00
ilovezfs
394b0884eb bump-formula-pr: handle gnu mirrors
and add explicit version when not preexisting
2016-09-27 02:46:08 -07:00
ilovezfs
a9a62972bd bump-formula-pr: handle explicit version DSL
--version=1.2.3 option to set `version "1.2.3"`

Note that --version=0 will remove a no-longer-needed explicit version
2016-09-27 02:46:08 -07:00
ilovezfs
19df03219b bump-formula-pr: --mirror option 2016-09-27 02:46:08 -07:00
ilovezfs
743e9bbdaa bump-formula-pr: formula name guessing 2016-09-27 02:46:08 -07:00
ilovezfs
ce092d90fa bump-formula-pr: set sha256 automatically when possible 2016-09-27 02:46:07 -07:00
Markus Reiter
6c6a4c9fa7 RuboCop: Style/AccessorMethodName 2016-09-24 19:28:26 +02:00
Mike McQuaid
bba6a59c0c dev-cmd/bump-formula-pr: fix Rubocop warnings. 2016-09-11 19:14:55 +01:00
ilovezfs
f5a462bca1 bump-formula-pr: audit formula before opening PR 2016-09-03 10:47:04 -07:00
Martin Afanasjew
bb4d168c48 Merge pull request #760 from jasonkarns/bump-formula-pr-return-to-branch
bump-formula-pr: return to starting branch
2016-08-20 11:36:43 +02:00
Jason Karns
f40fd1df90 bump-formula-pr: return to starting branch
After branching, bumping, pushing, and pr-ing; return to whatever branch
was originally checked out.

In most cases, I'd imagine users to want to continue receiving tap
updates from master. However, after using bump-formula-pr, the tap in
which the formula was bumped is left on the working branch that was
doing the bumping and pull-request. After opening the PR, we should
return to whatever branch the user originally had checked out – most
likely master. (But git allows us to just say "previous branch" by using
`-`)
2016-08-19 15:59:55 -04:00
Jason Karns
07efe1e771 bump-formula-pr now creates non-tracking branches
Without `--no-track`, some git setups may automatically set
`origin/master` as the tracked upstream for the newly created branch.
This upstream is what hub defaults as --head when opening PRs. By not
allowing git to set `origin/master` as upstream, hub can then use the
proper --head for the PR.

Since hub still needs to know what --head is intended to be, we can set
the branch's upstream when pushing: with the --set-upstream option.

Fixes #755
2016-08-19 10:50:51 -04:00
Martin Afanasjew
823505a058 Fix minor issues in command help text formatting
- Inconsistent or unneeded indentation
- Missing or superfluous empty lines
- Missing or wrongly formatted arguments in command summary
- Missing punctuation
2016-08-17 01:25:51 +02:00
Steven Peters
a67c6f6ca2 bump-formula-pr: format documentation for --help. 2016-08-08 08:42:40 +01:00
Xu Cheng
a8566c9848 various: eliminate the usage of any? (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
2016-08-05 22:01:32 +08:00
Xu Cheng
de1049f1f1
various: proper escape dot in regex 2016-07-13 19:11:46 +08:00
ilovezfs
96cbce015e bump-formula-pr: remove formula revision
If we're bumping the formula's stable version, then we also must reset
the formula revision to zero.

Note that if and only if a revision is being removed, this commit will
enforce the convention that there should be a blank line before a simple
head spec if and only if there is a formula revision. Any preexisting
violation of the convention (in particular, a blank line before a simple
head spec in the absence of a formula revision) won't be proactively
corrected since we'd not be removing a formula revision in that case.

Closes #369.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-06-17 08:55:13 -07:00
ilovezfs
cc0ca73183 bump-formula-pr: reflect new version in dry-run
- simulate version change for dry-run
- make sure we're using :devel version if called with --devel

Closes #318.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-06-16 14:25:53 -07:00
Christian Moritz
a87eb23a3b bump-formula-pr: fix typo in spec existence check
Closes Homebrew/homebrew#50472.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-28 18:22:47 +08:00
Mike McQuaid
ca2abb2be6 bump-formula-pr: add new command.
Add a new developer command (i.e. requires `HOMEBREW_DEVELOPER` set in
your environment) to bump the version of a formula and create a new pull
request with the new version.

Closes Homebrew/homebrew#49848.
2016-03-28 18:22:47 +08:00