Merge pull request #3467 from ilovezfs/bump-formula-pr-hub-not-configured
bump-formula-pr: fix for when hub isn't configured
This commit is contained in:
commit
9e93720e8f
@ -321,23 +321,41 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
|
ohai "hub fork # read $HUB_REMOTE"
|
||||||
ohai "git fetch --unshallow origin" if shallow
|
ohai "git fetch --unshallow origin" if shallow
|
||||||
ohai "git checkout --no-track -b #{branch} origin/master"
|
ohai "git checkout --no-track -b #{branch} origin/master"
|
||||||
ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}"
|
ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}"
|
||||||
ohai "hub fork # read $HUB_REMOTE"
|
|
||||||
ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}"
|
ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}"
|
||||||
ohai "hub pull-request #{hub_args.join(" ")} -m '#{formula.name} #{new_formula_version}#{devel_message}'"
|
ohai "hub pull-request #{hub_args.join(" ")} -m '#{formula.name} #{new_formula_version}#{devel_message}'"
|
||||||
ohai "git checkout -"
|
ohai "git checkout -"
|
||||||
else
|
else
|
||||||
|
reply = IO.popen(["hub", "fork"], "r+", err: "/dev/null") do |io|
|
||||||
|
reader = Thread.new { io.read }
|
||||||
|
sleep 1
|
||||||
|
io.close_write
|
||||||
|
reader.value
|
||||||
|
end
|
||||||
|
|
||||||
|
if reply.to_s.include? "username:"
|
||||||
|
formula.path.atomic_write(backup_file) unless ARGV.dry_run?
|
||||||
|
odie "You need to configure hub"
|
||||||
|
end
|
||||||
|
|
||||||
|
remote = reply[/remote:? (\S+)/, 1]
|
||||||
|
|
||||||
|
# repeat for hub 2.2 backwards compatibility:
|
||||||
|
remote = Utils.popen_read("hub fork 2>&1")[/remote:? (\S+)/, 1] if remote.to_s.empty?
|
||||||
|
|
||||||
|
if remote.to_s.empty?
|
||||||
|
formula.path.atomic_write(backup_file) unless ARGV.dry_run?
|
||||||
|
odie "cannot get remote from 'hub'!"
|
||||||
|
end
|
||||||
|
|
||||||
safe_system "git", "fetch", "--unshallow", "origin" if shallow
|
safe_system "git", "fetch", "--unshallow", "origin" if shallow
|
||||||
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
|
||||||
safe_system "git", "commit", "--no-edit", "--verbose",
|
safe_system "git", "commit", "--no-edit", "--verbose",
|
||||||
"--message=#{formula.name} #{new_formula_version}#{devel_message}",
|
"--message=#{formula.name} #{new_formula_version}#{devel_message}",
|
||||||
"--", formula.path
|
"--", formula.path
|
||||||
remote = Utils.popen_read("hub fork 2>&1")[/remote:? (\S+)/, 1]
|
|
||||||
# repeat for hub 2.2 backwards compatibility:
|
|
||||||
remote = Utils.popen_read("hub fork 2>&1")[/remote:? (\S+)/, 1] 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}"
|
||||||
pr_message = <<~EOS
|
pr_message = <<~EOS
|
||||||
#{formula.name} #{new_formula_version}#{devel_message}
|
#{formula.name} #{new_formula_version}#{devel_message}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user