pull: merge and rebase when pulling bottles.

This seems to be a more robust approach when a PR has multiple commits.
This commit is contained in:
Mike McQuaid 2015-01-15 11:11:24 +00:00
parent 53d848e364
commit dac4848661

View File

@ -85,8 +85,9 @@ module Homebrew
# The cache directory seems like a good place to put patches. # The cache directory seems like a good place to put patches.
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
# Store current revision # Store current revision and branch
revision = `git rev-parse --short HEAD`.strip revision = `git rev-parse --short HEAD`.strip
branch = `git symbolic-ref --short HEAD`.strip
pull_url url pull_url url
@ -139,11 +140,17 @@ module Homebrew
end end
if ARGV.include? "--bottle" if ARGV.include? "--bottle"
bottle_branch = "pull-bottle-#{issue}"
safe_system "git", "checkout", "-B", bottle_branch, revision
if tap_name if tap_name
pull_url "https://github.com/BrewTestBot/homebrew-#{tap_name}/compare/homebrew:master...pr-#{issue}" pull_url "https://github.com/BrewTestBot/homebrew-#{tap_name}/compare/homebrew:master...pr-#{issue}"
else else
pull_url "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}" pull_url "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}"
end end
safe_system "git", "rebase", branch
safe_system "git", "checkout", branch
safe_system "git", "merge", "--ff-only", "--no-edit", bottle_branch
safe_system "git", "branch", "-D", bottle_branch
end end
ohai 'Patch changed:' ohai 'Patch changed:'