Skip to content

Commit

Permalink
Updates pull-request CMD to the new GH UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Cunha committed Jun 18, 2013
1 parent f011f81 commit d582656
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions bin/git-pull-request
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ class App < Git::Whistles::App
die "You cannot issue a pull request to the same branch (#{options.from})."
end

# build the base query
query = {
:base_repo => repo,
:base_ref => options.to,
:head_ref => options.from
}
query = { }

# guess team name
if options.from =~ %r{^(\w+)/.*}
Expand All @@ -53,15 +48,15 @@ class App < Git::Whistles::App

# guess title.
title = options.from.split('/').last.split(/[_-]/).delete_if { |word| word =~ /^\d+$/ }.join(' ').capitalize
query[:title] = team ? "#{team}: #{title}" : title
query[:"pull_request[title]"] = team ? "#{team}: #{title}" : title

# add Pivotal infos
add_pivotal_info(query, $1.to_i) if options.from =~ /(\d+)$/

query_string = query.map { |key,value|
"#{CGI.escape key.to_s}=#{CGI.escape value}"
}.join('&')
url = "https://github.com/#{repo}/pull/new?#{query_string}"
url = "https://github.com/#{repo}/compare/#{options.to}...#{options.from}?#{query_string}"
puts "Preparing a pull request for branch #{options.from}"

unless launch_browser(url)
Expand Down

0 comments on commit d582656

Please sign in to comment.