Skip to content
Snippets Groups Projects
Commit 7962b15a authored by Misty De Meo's avatar Misty De Meo
Browse files

search: use v2 API


The v3 API currently lacks a search feature. Use the v2 API instead for
much faster pull request filtering.

Closes Homebrew/homebrew#9592.

Signed-off-by: default avatarMisty De Meo <mistydemeo@gmail.com>
parent 6626966d
No related branches found
No related tags found
No related merge requests found
......@@ -433,20 +433,14 @@ module GitHub extend self
require 'vendor/multi_json'
pulls = []
uri = URI.parse("https://api.github.com/repos/mxcl/homebrew/pulls")
uri.query = "per_page=100"
query = rx.source.delete '.*'
uri = URI.parse("http://github.com/api/v2/json/issues/search/mxcl/homebrew/open/#{query}")
open uri do |f|
MultiJson.decode((f.read)).each do |pull|
pulls << pull['html_url'] if rx.match pull['title']
MultiJson.decode(f.read)["issues"].each do |pull|
pulls << pull['pull_request_url'] if rx.match pull['title'] and pull["pull_request_url"]
end
uri = if f.meta['link'] =~ /rel="next"/
f.meta['link'].slice(URI.regexp)
else
nil
end
end while uri
end
pulls
rescue
[]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment