aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/pull.rb
diff options
context:
space:
mode:
authorMike McQuaid2015-07-03 10:59:53 +0100
committerMike McQuaid2015-07-03 10:59:53 +0100
commit33fa3bacf6fa93e8f9f8a60d875eb45dc7b76462 (patch)
tree8764e12414d502b337a133cbf3dbe4920efe6cbf /Library/Homebrew/cmd/pull.rb
parent310afba0267b5f69ce19c8b7d162c96f8216b03f (diff)
downloadbrew-33fa3bacf6fa93e8f9f8a60d875eb45dc7b76462.tar.bz2
pull: support Jenkins "Homebrew Testing" jobs.
Diffstat (limited to 'Library/Homebrew/cmd/pull.rb')
-rw-r--r--Library/Homebrew/cmd/pull.rb24
1 files changed, 17 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index c321941b8..4458dfe1a 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -59,8 +59,12 @@ module Homebrew
ARGV.named.each do |arg|
if arg.to_i > 0
- url = 'https://github.com/Homebrew/homebrew/pull/' + arg
+ url = "https://github.com/Homebrew/homebrew/pull/#{arg}"
issue = arg
+ elsif (testing_match = arg.match %r{brew.sh/job/Homebrew%20Testing/(\d+)/})
+ _, testing_job = *testing_match
+ url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}"
+ odie "Testing URLs require `--bottle`!" unless ARGV.include?('--bottle')
else
if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
_, user, tap, pull = *api_match
@@ -74,11 +78,11 @@ module Homebrew
issue = url_match[3]
end
- if ARGV.include?("--bottle") && issue.nil?
+ if !testing_job && ARGV.include?("--bottle") && issue.nil?
raise "No pull request detected!"
end
- if tap_name = tap(url)
+ if !testing_job && tap_name = tap(url)
user = url_match[1].downcase
tap_dir = HOMEBREW_REPOSITORY/"Library/Taps/#{user}/homebrew-#{tap_name}"
safe_system "brew", "tap", "#{user}/#{tap_name}" unless tap_dir.exist?
@@ -150,14 +154,20 @@ module Homebrew
end
if ARGV.include? "--bottle"
- bottle_commit_url = if tap_name
- "https://github.com/BrewTestBot/homebrew-#{tap_name}/compare/homebrew:master...pr-#{issue}"
+
+ bottle_commit_url = if testing_job
+ bottle_branch = "testing-bottle-#{testing_job}"
+ url
else
- "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}"
+ bottle_branch = "pull-bottle-#{issue}"
+ if tap_name
+ "https://github.com/BrewTestBot/homebrew-#{tap_name}/compare/homebrew:master...pr-#{issue}"
+ else
+ "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}"
+ end
end
curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url
- bottle_branch = "pull-bottle-#{issue}"
safe_system "git", "checkout", "-B", bottle_branch, revision
pull_url bottle_commit_url
safe_system "git", "rebase", branch