Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Conversation

MikeMcQuaid
Copy link
Member

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.

CC @mdiep @mislav @xu-cheng

safe_system "hub", "fork", "--no-remote"
quiet_system "hub", "fork"
/fatal: remote (.+) already exists./ =~ Utils.popen_read("hub fork 2>&1")
remote = $1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remote = Utils.popen_read("hub", "fork")[/fatal: remote (.+) already exists./, 1]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@xu-cheng
Copy link
Contributor

xu-cheng commented Mar 8, 2016

What happens if my origin remote is pointed to my own fork and the upstream is pointed to the Homebrew? Sorry, but this is my personal setup.

resource_specs = formula_spec.specs
old_tag = resource_specs[:tag]
old_revision = resource_specs[:revision]
s.gsub!(old_tag, new_tag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tag is usually version string. This replacement may happen in the wrong places, e.g resources.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions for a better replacement?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.gsub!("\"#{old_tag}\"", "\"#{new_tag}\"")
@MikeMcQuaid
Copy link
Member Author

What happens if my origin remote is pointed to my own fork and the upstream is pointed to the Homebrew? Sorry, but this is my personal setup.

I guess you can play around with hub fork locally and see how it handles that case. The tricky thing is there's not an easy way to get your GitHub username so I'd be in favour of just making this work for the easy-path, even if it requires e.g. a duplicate remote.

@ilovezfs
Copy link
Contributor

ilovezfs commented Mar 9, 2016

@MikeMcQuaid Actually, getting the username should be straightforward since it's required for hub:

Josephs-MacBook-Pro:homebrew joe$ grep user ~/.config/hub 
- user: ilovezfs
ilovezfs pushed a commit to ilovezfs/legacy-homebrew that referenced this pull request Mar 9, 2016
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#49848.

Signed-off-by: ilovezfs <[email protected]>

formula.path.parent.cd do
branch = "#{formula.name}-#{new_formula_version}"
safe_system "git", "checkout", "-b", branch, "master"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may want origin/master (or upstream/master if you go with @xu-cheng's naming convention) not master to avoid what just happened to me (as a result of having done brew pull 49848 first) :
![alt text](http://i.imgur.com/jDdvaQQ.png oops)

@ilovezfs
Copy link
Contributor

ilovezfs commented Mar 9, 2016

bump-formula-pr may need some clean-up code when it fails that deletes the branch, reverts the changes, and puts you back on master (or whatever branch you were on originally), so that it's re-runnable. Otherwise, failures have to be manually unwound with git boilerplate before re-running the command.

When the command succeeds, it probably should put you back on your original branch as well.

Also, I think it would be nice if the command would guess the url based on a basic version string replacement if a full URL isn't provided, and also automatically compute the checksum when the download is successful (and possibly also that the archive can be unpacked just to verify it's sane).

As noted here #49918 (comment), the command needs to delete any revision line as well.

@ilovezfs
Copy link
Contributor

@MikeMcQuaid Having second thoughts about this one?

@MikeMcQuaid
Copy link
Member Author

@ilovezfs Nope, just been busy!

@ilovezfs
Copy link
Contributor

@MikeMcQuaid Ah, ok! I'd suggest at least integrating the master -> origin/master change so that this can be used via brew pull without replicating my blunder above.

@MikeMcQuaid
Copy link
Member Author

Updated (on ✈️ so not tested) and then will ship this soon if it works and there's no objections.

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 #49848.
@MikeMcQuaid MikeMcQuaid merged commit f106809 into Homebrew:master Mar 27, 2016
@MikeMcQuaid MikeMcQuaid deleted the bump-formula-pr branch March 27, 2016 09:35
xu-cheng pushed a commit to Homebrew/brew that referenced this pull request Mar 28, 2016
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/legacy-homebrew#49848.
@zbeekman
Copy link
Contributor

zbeekman commented Apr 1, 2016

Is the usage documented somewhere? (For bump-formula-pr... )

@zbeekman
Copy link
Contributor

zbeekman commented Apr 1, 2016

just saw the comments in the file diff... ignore my previous post

@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants