aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2015-03-20 17:43:04 +0000
committerMike McQuaid2015-03-20 17:46:18 +0000
commit0d99e7a55fc10ad508a196902afcd9c9cc57e5d1 (patch)
treec3550d0e9412a809097d1b26a1fe1c4d7d0a847c /Library/Homebrew/cmd
parent8ded17e6f3216abf283954f2f7d47ac091b568f3 (diff)
downloadhomebrew-0d99e7a55fc10ad508a196902afcd9c9cc57e5d1.tar.bz2
pull: allow pulling from API URLs.
Jenkins has started spitting these out; no idea why.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/pull.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index 5aaa09a64..654ef1fe6 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -6,6 +6,8 @@ require 'formula'
require 'cmd/tap'
module Homebrew
+ HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/homebrew(-[\w-]+)?/pulls/(\d+)}
+
def tap arg
match = arg.match(%r[homebrew-([\w-]+)/])
match[1].downcase if match
@@ -60,6 +62,11 @@ module Homebrew
url = 'https://github.com/Homebrew/homebrew/pull/' + arg
issue = arg
else
+ if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
+ _, user, tap, pull = *api_match
+ arg = "https://github.com/#{user}/homebrew#{tap}/pull/#{pull}"
+ end
+
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
unless url_match
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"