diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43ca1683a19bf93225a479fb400862f0d696c704..a31092c1a8f6d08bec4e70a3a6cf58768911b015 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,11 @@ Contributing to hub =================== +**Warning:** in the near future, hub might be implemented +[entirely in Go instead of Ruby](https://github.com/github/hub/issues/475). +Keep that in mind, and don't contribute big features/refactorings to +the Ruby codebase, as such pull requests will be unlikely to get accepted. + You will need: 1. Ruby 1.8.7+ diff --git a/README.md b/README.md index 97c0afce7800512fe63fb49d4490725f4f906d7f..0bd39b3e75214b049a477f398ce412dc52bbf0cc 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ superpowers: ### git checkout $ git checkout https://github.com/defunkt/hub/pull/73 - > git remote add -f -t feature git://github:com/mislav/hub.git + > git remote add -f -t feature mislav git://github.com/mislav/hub.git > git checkout --track -B mislav-feature mislav/feature $ git checkout https://github.com/defunkt/hub/pull/73 custom-branch-name diff --git a/Rakefile b/Rakefile index 29f89506dd80d9cc83e7957e4fb6bf9892b8198f..f913f36ee719227458b2eafb04dbfe0ad72e9a91 100644 --- a/Rakefile +++ b/Rakefile @@ -157,6 +157,7 @@ end desc "Publish to Homebrew" task :homebrew do require File.expand_path('../lib/hub/version', __FILE__) + ENV['RUBYOPT'] = '' Dir.chdir `brew --prefix`.chomp do sh 'git checkout -q master' sh 'git pull -q origin master' @@ -172,9 +173,9 @@ task :homebrew do branch = "hub-v#{Hub::VERSION}" sh "git checkout -q -B #{branch}" - sh "git commit -m 'hub v#{Hub::VERSION}' -- #{formula_file}" + sh "git commit -m 'hub #{Hub::VERSION}' -- #{formula_file}" sh "git push -u mislav #{branch}" - sh "hub pull-request -m 'upgrade hub to v#{Hub::VERSION}'" + sh "hub pull-request -m 'hub #{Hub::VERSION}'" sh "git checkout -q master" end diff --git a/features/authentication.feature b/features/authentication.feature index 5eefbcadb498ac723d7dc73ab945dbf3a18f13b4..cd1d09b4955277d133597456ecf4c8f6f8de47dc 100644 --- a/features/authentication.feature +++ b/features/authentication.feature @@ -40,8 +40,8 @@ Feature: OAuth authentication auth = Rack::Auth::Basic::Request.new(env) halt 401 unless auth.credentials == %w[mislav kitty] json [ - {:token => 'SKIPPD', :app => {:url => 'http://example.com'}}, - {:token => 'OTOKEN', :app => {:url => 'http://hub.github.com/'}} + {:token => 'SKIPPD', :note_url => 'http://example.com'}, + {:token => 'OTOKEN', :note_url => 'http://hub.github.com/'} ] } get('/user') { @@ -58,6 +58,36 @@ Feature: OAuth authentication And the exit status should be 0 And the file "../home/.config/hub" should contain 'access_token = "OTOKEN"' + Scenario: Re-use existing authorization with an old URL + Given the GitHub API server: + """ + require 'rack/auth/basic' + get('/authorizations') { + auth = Rack::Auth::Basic::Request.new(env) + halt 401 unless auth.credentials == %w[mislav kitty] + json [ + {:token => 'OTOKEN', :note => 'hub', :note_url => 'http://defunkt.io/hub/'} + ] + } + post('/authorizations') { + status 422 + json :message => "Validation Failed", + :errors => [{:resource => "OauthAccess", :code => "already_exists", :field => "description"}] + } + get('/user') { + json :login => 'mislav' + } + post('/user/repos') { + json :full_name => 'mislav/dotfiles' + } + """ + When I run `hub create` interactively + When I type "mislav" + And I type "kitty" + Then the output should contain "github.com password for mislav (never stored):" + And the exit status should be 0 + And the file "../home/.config/hub" should contain "oauth_token: OTOKEN" + Scenario: Credentials from GITHUB_USER & GITHUB_PASSWORD Given the GitHub API server: """ @@ -66,7 +96,7 @@ Feature: OAuth authentication auth = Rack::Auth::Basic::Request.new(env) halt 401 unless auth.credentials == %w[mislav kitty] json [ - {:token => 'OTOKEN', :app => {:url => 'http://hub.github.com/'}} + {:token => 'OTOKEN', :note_url => 'http://hub.github.com/'} ] } get('/user') { @@ -154,7 +184,7 @@ Feature: OAuth authentication end json [ { :token => token, - :app => {:url => 'http://hub.github.com/'} + :note_url => 'http://hub.github.com/' } ] } get('/user') { diff --git a/features/browse.feature b/features/browse.feature index b11d998e6151acc22b08505c2eeac9ecb6e24317..6f4eb0f1ac0a7f89c16f62f1dafa2283a7ed01b6 100644 --- a/features/browse.feature +++ b/features/browse.feature @@ -134,3 +134,17 @@ Feature: hub browse And the "upstream" remote has url "../path/to/another/repo.git" When I successfully run `hub browse` Then "open https://github.com/mislav/dotfiles" should be run + + Scenario: Enterprise repo + Given I am in "git://git.my.org/mislav/dotfiles.git" git repo + And I am "mislav" on git.my.org with OAuth token "FITOKEN" + And "git.my.org" is a whitelisted Enterprise host + When I successfully run `hub browse` + Then "open https://git.my.org/mislav/dotfiles" should be run + + Scenario: Enterprise repo over HTTP + Given I am in "git://git.my.org/mislav/dotfiles.git" git repo + And I am "mislav" on http://git.my.org with OAuth token "FITOKEN" + And "git.my.org" is a whitelisted Enterprise host + When I successfully run `hub browse` + Then "open http://git.my.org/mislav/dotfiles" should be run diff --git a/features/compare.feature b/features/compare.feature index 69ca8d5430cfda10f5515d9b161cdcf054418f76..5eeb97ecf1af8e78cea59065321f80a608209582 100644 --- a/features/compare.feature +++ b/features/compare.feature @@ -81,3 +81,11 @@ Feature: hub compare When I successfully run `hub compare anotheruser feature` Then there should be no output And "open https://github.com/anotheruser/dotfiles/compare/feature" should be run + + Scenario: Enterprise repo over HTTP + Given the "origin" remote has url "git://git.my.org/mislav/dotfiles.git" + And I am "mislav" on http://git.my.org with OAuth token "FITOKEN" + And "git.my.org" is a whitelisted Enterprise host + When I successfully run `hub compare refactor` + Then there should be no output + And "open http://git.my.org/mislav/dotfiles/compare/refactor" should be run diff --git a/features/create.feature b/features/create.feature index 17a174560daf39ed06c52f54182d277810f0dda8..2720eea91980978f842b8e70524b436cd7e8a771 100644 --- a/features/create.feature +++ b/features/create.feature @@ -129,3 +129,32 @@ Feature: hub create """ When I successfully run `hub create` Then the url for "origin" should be "git@github.com:mislav/my-dot-files.git" + + Scenario: Verbose API output + Given the GitHub API server: + """ + get('/repos/mislav/dotfiles') { status 404 } + post('/user/repos') { + response['location'] = 'http://disney.com' + json :full_name => 'mislav/dotfiles' + } + """ + And $HUB_VERBOSE is "on" + When I successfully run `hub create` + Then the stderr should contain: + """ + > GET https://api.github.com/repos/mislav/dotfiles + > Authorization: token [REDACTED] + < HTTP 404 + """ + And the stderr should contain: + """ + > POST https://api.github.com/user/repos + > Authorization: token [REDACTED] + """ + And the stderr should contain: + """ + < HTTP 200 + < Location: http://disney.com + {"full_name":"mislav/dotfiles"}\n + """ diff --git a/features/fork.feature b/features/fork.feature index cbe9da94d6c1eeddfef2e237a0b7015ff68f7437..dffe8fc81336e7edb4dee8396670a6af381a9989 100644 --- a/features/fork.feature +++ b/features/fork.feature @@ -7,7 +7,10 @@ Feature: hub fork Scenario: Fork the repository Given the GitHub API server: """ - before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' } + before { + halt 400 unless request.env['HTTP_X_ORIGINAL_SCHEME'] == 'https' + halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' + } get('/repos/mislav/dotfiles', :host_name => 'api.github.com') { 404 } post('/repos/evilchelu/dotfiles/forks', :host_name => 'api.github.com') { '' } """ @@ -121,7 +124,10 @@ Scenario: Related fork already exists Scenario: Enterprise fork Given the GitHub API server: """ - before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token FITOKEN' } + before { + halt 400 unless request.env['HTTP_X_ORIGINAL_SCHEME'] == 'https' + halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token FITOKEN' + } post('/api/v3/repos/evilchelu/dotfiles/forks', :host_name => 'git.my.org') { '' } """ And the "origin" remote has url "git@git.my.org:evilchelu/dotfiles.git" @@ -129,3 +135,18 @@ Scenario: Related fork already exists And "git.my.org" is a whitelisted Enterprise host When I successfully run `hub fork` Then the url for "mislav" should be "git@git.my.org:mislav/dotfiles.git" + + Scenario: Enterprise fork using regular HTTP + Given the GitHub API server: + """ + before { + halt 400 unless request.env['HTTP_X_ORIGINAL_SCHEME'] == 'http' + halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token FITOKEN' + } + post('/api/v3/repos/evilchelu/dotfiles/forks', :host_name => 'git.my.org') { '' } + """ + And the "origin" remote has url "git@git.my.org:evilchelu/dotfiles.git" + And I am "mislav" on http://git.my.org with OAuth token "FITOKEN" + And "git.my.org" is a whitelisted Enterprise host + When I successfully run `hub fork` + Then the url for "mislav" should be "git@git.my.org:mislav/dotfiles.git" diff --git a/features/merge.feature b/features/merge.feature index 7ea18897585df10344114a463aaead645ec470e1..79d8f7df37c7f46d73fa973f669282f7d08b6323 100644 --- a/features/merge.feature +++ b/features/merge.feature @@ -11,7 +11,7 @@ Feature: hub merge get('/repos/defunkt/hub/pulls/164') { json \ :head => { :label => 'jfirebaugh:hub_merge', - :repo => {:private => false} + :repo => {:private => false, :name=>"hub"} }, :title => "Add `hub merge` command" } @@ -34,7 +34,7 @@ Feature: hub merge get('/repos/defunkt/hub/pulls/164') { json \ :head => { :label => 'jfirebaugh:hub_merge', - :repo => {:private => false} + :repo => {:private => false, :name=>"hub"} }, :title => "Add `hub merge` command" } @@ -55,7 +55,7 @@ Feature: hub merge get('/repos/defunkt/hub/pulls/164') { json \ :head => { :label => 'jfirebaugh:hub_merge', - :repo => {:private => true} + :repo => {:private => true, :name=>"hub"} }, :title => "Add `hub merge` command" } @@ -82,6 +82,21 @@ Feature: hub merge Error: jfirebaugh's fork is not available anymore\n """ + Scenario: Renamed repo + Given the GitHub API server: + """ + require 'json' + get('/repos/defunkt/hub/pulls/164') { json \ + :head => { + :label => 'jfirebaugh:hub_merge', + :repo => {:private => false, :name=>"hub-1"} + } + } + """ + And there is a commit named "jfirebaugh/hub_merge" + When I successfully run `hub merge https://github.com/defunkt/hub/pull/164` + Then "git fetch git://github.com/jfirebaugh/hub-1.git +refs/heads/hub_merge:refs/remotes/jfirebaugh/hub_merge" should be run + Scenario: Unchanged merge When I run `hub merge master` Then "git merge master" should be run diff --git a/features/pull_request.feature b/features/pull_request.feature index c75c99e0237791940293ebe3c4ac94ddb32b1ba5..89b71f97e438f783340239c51cbff305755d9117 100644 --- a/features/pull_request.feature +++ b/features/pull_request.feature @@ -43,6 +43,11 @@ Feature: hub pull-request When I successfully run `hub pull-request -m ăéñøü` Then the output should contain exactly "the://url\n" + Scenario: Deprecated title argument can't start with a dash + When I run `hub pull-request -help` + Then the stderr should contain "invalid argument: -help\n" + And the exit status should be 1 + Scenario: Non-existing base Given the GitHub API server: """ @@ -415,3 +420,13 @@ Feature: hub pull-request """ When I successfully run `hub pull-request -m hereyougo` Then the output should contain exactly "the://url\n" + + Scenario: Open pull request in web browser + Given the GitHub API server: + """ + post('/repos/mislav/coral/pulls') { + json :html_url => "the://url" + } + """ + When I successfully run `hub pull-request -o -m hereyougo` + Then "open the://url" should be run diff --git a/features/steps.rb b/features/steps.rb index af6b1d0b471691387f728110e4d4a4f2178b0117..26f470c953ef8c8064b89d334a86b9aa91419cc4 100644 --- a/features/steps.rb +++ b/features/steps.rb @@ -25,9 +25,12 @@ Given(/^the "([^"]*)" remote has url "([^"]*)"$/) do |remote_name, url| end end -Given(/^I am "([^"]*)" on ([\w.-]+)(?: with OAuth token "([^"]*)")?$/) do |name, host, token| +Given(/^I am "([^"]*)" on ([\S]+)(?: with OAuth token "([^"]*)")?$/) do |name, host, token| edit_hub_config do |cfg| - entry = { 'user' => name, 'host' => host } + entry = {'user' => name} + host = host.sub(%r{^([\w-]+)://}, '') + entry['host'] = host + entry['protocol'] = $1 if $1 entry['access_token'] = token if token cfg << entry end diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb index 80fc98cfaf0d3b619c1d74bce4991875320ed1e8..f24e6f369c34fe93552f4082d094cb1e6d9d3199 100644 --- a/lib/hub/commands.rb +++ b/lib/hub/commands.rb @@ -111,6 +111,10 @@ module Hub $stdout.puts ref_state end exit exit_code + rescue GitHubAPI::Exceptions + response = $!.response + display_api_exception("fetching CI status", response) + exit 1 end # $ hub pull-request @@ -158,11 +162,13 @@ module Hub head_project, options[:head] = from_github_ref.call(head, head_project) when '-i' options[:issue] = args.shift + when '-o', '--browse' + open_with_browser = true else if url = resolve_github_url(arg) and url.project_path =~ /^issues\/(\d+)/ options[:issue] = $1 base_project = url.project - elsif !options[:title] + elsif !options[:title] && arg.index('-') != 0 options[:title] = arg warn "hub: Specifying pull request title without a flag is deprecated." warn "Please use one of `-m' or `-F' options." @@ -237,8 +243,10 @@ module Hub pull = api_client.create_pullrequest(options) - args.executable = 'echo' - args.replace [pull['html_url']] + args.push('-u') unless open_with_browser + browse_command(args) do + pull['html_url'] + end rescue GitHubAPI::Exceptions response = $!.response display_api_exception("creating pull request", response) @@ -435,8 +443,9 @@ module Hub user, branch = pull_data['head']['label'].split(':', 2) abort "Error: #{user}'s fork is not available anymore" unless pull_data['head']['repo'] - url = github_project(url.project_name, user).git_url(:private => pull_data['head']['repo']['private'], - :https => https_protocol?) + repo_name = pull_data['head']['repo']['name'] + url = github_project(repo_name, user).git_url(:private => pull_data['head']['repo']['private'], + :https => https_protocol?) merge_head = "#{user}/#{branch}" args.before ['fetch', url, "+refs/heads/#{branch}:refs/remotes/#{merge_head}"] @@ -693,7 +702,7 @@ module Hub "/#{subpage}" end - project.web_url(path) + project.web_url(path, api_client.config.method(:protocol)) end end @@ -724,7 +733,8 @@ module Hub end end - project.web_url "/compare/#{range.tr('/', ';')}" + path = '/compare/%s' % range.tr('/', ';') + project.web_url(path, api_client.config.method(:protocol)) end end @@ -829,7 +839,9 @@ module Hub config_file = ENV['HUB_CONFIG'] || '~/.config/hub' file_store = GitHubAPI::FileStore.new File.expand_path(config_file) file_config = GitHubAPI::Configuration.new file_store - GitHubAPI.new file_config, :app_url => 'http://hub.github.com/' + GitHubAPI.new file_config, + :app_url => 'http://hub.github.com/', + :verbose => !ENV['HUB_VERBOSE'].to_s.empty? end end @@ -1032,7 +1044,7 @@ help write.close # Don't page if the input is short enough - ENV['LESS'] = 'FSRX' + ENV['LESS'] = 'FSR' # Wait until we have input before we start the pager Kernel.select [STDIN] diff --git a/lib/hub/context.rb b/lib/hub/context.rb index cadbd7d39ea4b4fc209dfe9b6e8e2d5b27328842..a41fcbbc6c417bae172121d4b0831c7debd76779 100644 --- a/lib/hub/context.rb +++ b/lib/hub/context.rb @@ -288,7 +288,7 @@ module Hub local_repo.remotes.find { |r| r.project == self } end - def web_url(path = nil) + def web_url(path = nil, protocol_config = nil) project_name = name_with_owner if project_name.sub!(/\.wiki$/, '') unless '/wiki' == path @@ -298,7 +298,11 @@ module Hub path = '/wiki' + path end end - "https://#{host}/" + project_name + path.to_s + '%s://%s/%s' % [ + protocol_config ? protocol_config.call(host) : 'https', + host, + project_name + path.to_s + ] end def git_url(options = {}) diff --git a/lib/hub/github_api.rb b/lib/hub/github_api.rb index 488d9a0c9f163e4de8d7d8f6a934a5a6fa06cc6c..e751d193380c57bebe4a248edb843978e6359b4a 100644 --- a/lib/hub/github_api.rb +++ b/lib/hub/github_api.rb @@ -27,8 +27,11 @@ module Hub def initialize config, options @config = config @oauth_app_url = options.fetch(:app_url) + @verbose = options.fetch(:verbose, false) end + def verbose?() @verbose end + # Fake exception type for net/http exception handling. # Necessary because net/http may or may not be loaded at the time. module Exceptions @@ -180,6 +183,8 @@ module Hub when 'custom' then err['message'] when 'missing_field' %(Missing field: "%s") % err['field'] + when 'already_exists' + %(Duplicate value for "%s") % err['field'] when 'invalid' %(Invalid value for "%s": "%s") % [ err['field'], err['value'] ] when 'unauthorized' @@ -246,8 +251,10 @@ module Hub end def configure_connection req, url + url.scheme = config.protocol(url.host) if ENV['HUB_TEST_HOST'] req['Host'] = url.host + req['X-Original-Scheme'] = url.scheme url = url.dup url.scheme = 'http' url.host, test_port = ENV['HUB_TEST_HOST'].split(':') @@ -322,7 +329,7 @@ module Hub end end - if found = res.data.find {|auth| auth['app']['url'] == oauth_app_url } + if found = res.data.find {|auth| auth['note'] == 'hub' || auth['note_url'] == oauth_app_url } found['token'] else # create a new authorization @@ -342,9 +349,63 @@ module Hub end end + module Verbose + def finalize_request(req, url) + super + dump_request_info(req, url) if verbose? + end + + def perform_request(*) + res = super + dump_response_info(res) if verbose? + res + end + + def verbose_puts(msg) + msg = "\e[36m%s\e[m" % msg if $stderr.tty? + $stderr.puts msg + end + + def dump_request_info(req, url) + verbose_puts "> %s %s://%s%s" % [ + req.method.to_s.upcase, + url.scheme, + url.host, + req.path, + ] + dump_headers(req, '> ') + dump_body(req) + end + + def dump_response_info(res) + verbose_puts "< HTTP %s" % res.status + dump_headers(res, '< ') + dump_body(res) + end + + def dump_body(obj) + verbose_puts obj.body if obj.body + end + + DUMP_HEADERS = %w[ Authorization X-GitHub-OTP Location ] + + def dump_headers(obj, indent) + DUMP_HEADERS.each do |header| + if value = obj[header] + verbose_puts '%s%s: %s' % [ + indent, + header, + value.sub(/^(basic|token) (.+)/i, '\1 [REDACTED]'), + ] + end + end + end + end + include HttpMethods include OAuth include GistAuth + include Verbose # Filesystem store suitable for Configuration class FileStore @@ -472,6 +533,11 @@ module Hub end end + def protocol host + host = normalize_host host + @data.fetch_value(host, nil, :protocol) { 'https' } + end + def value_to_persist(value = nil) @data.persist_next_change! value @@ -481,6 +547,7 @@ module Hub print "#{what}: " $stdin.gets.chomp rescue Interrupt + puts abort end @@ -496,6 +563,7 @@ module Hub $stdin.gets.chomp end rescue Interrupt + puts abort end @@ -503,6 +571,7 @@ module Hub print "two-factor authentication code: " $stdin.gets.chomp rescue Interrupt + puts abort end diff --git a/lib/hub/version.rb b/lib/hub/version.rb index b60cbf993dc8bcd0cf1fb22e7918e8d0ad07141b..8355d1a9e3a60cba1657736a3c7992e266858fc5 100644 --- a/lib/hub/version.rb +++ b/lib/hub/version.rb @@ -1,3 +1,3 @@ module Hub - Version = VERSION = '1.11.2' + Version = VERSION = '1.12.0' end diff --git a/man/hub.1 b/man/hub.1 index c1d4d41bd8a0e4b3d18e62de8e164d3bf3862baa..491899a49373168d4c1bacaf49be699ed593e474 100644 --- a/man/hub.1 +++ b/man/hub.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "HUB" "1" "December 2013" "GITHUB" "Hub Manual" +.TH "HUB" "1" "February 2014" "GITHUB" "Hub Manual" . .SH "NAME" \fBhub\fR \- git + hub = github @@ -61,7 +61,7 @@ \fBgit fork\fR [\fB\-\-no\-remote\fR] . .br -\fBgit pull\-request\fR [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] +\fBgit pull\-request\fR [\fB\-o\fR|\fB\-\-browse\fR] [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] . .br \fBgit ci\-status\fR [\fB\-v\fR] [\fICOMMIT\fR] @@ -148,13 +148,16 @@ Open a GitHub compare view page in the system\'s default web browser\. \fISTART\ Forks the original project (referenced by "origin" remote) on GitHub and adds a new remote for it under your username\. . .TP -\fBgit pull\-request\fR [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] +\fBgit pull\-request\fR [\fB\-o\fR|\fB\-\-browse\fR] [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] Opens a pull request on GitHub for the project that the "origin" remote points to\. The default head of the pull request is the current branch\. Both base and head of the pull request can be explicitly given in one of the following formats: "branch", "owner:branch", "owner/repo:branch"\. This command will abort operation if it detects that the current topic branch has local commits that are not yet pushed to its upstream branch on the remote\. To skip this check, use \fB\-f\fR\. . .IP Without \fIMESSAGE\fR or \fIFILE\fR, a text editor will open in which title and body of the pull request can be entered in the same manner as git commit message\. Pull request message can also be passed via stdin with \fB\-F \-\fR\. . .IP +With \fB\-o\fR or \fB\-\-browse\fR, the new pull request will open in the web browser\. +. +.IP Issue to pull request conversion via \fB\-i \fR or \fIISSUE\-URL\fR arguments is deprecated and will likely be removed from the future versions of both hub and GitHub API\. . .TP diff --git a/man/hub.1.html b/man/hub.1.html index 2b42b430766c58167a603902f026589628d8e6fd..39d054da1dd7c5b645fdf10d28e26b809fbe8f2e 100644 --- a/man/hub.1.html +++ b/man/hub.1.html @@ -100,7 +100,7 @@ git browse [-u] [[USER/]REPOSITORY] [SUBPAGE]
git compare [-u] [USER] [[START...]END]
git fork [--no-remote]
-git pull-request [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]
+git pull-request [-o|--browse] [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]
git ci-status [-v] [COMMIT]

DESCRIPTION

@@ -184,7 +184,7 @@ If END is omitted, GitHub compare view is opened for the current bran With -u, outputs the URL rather than opening the browser.

git fork [--no-remote]

Forks the original project (referenced by "origin" remote) on GitHub and adds a new remote for it under your username.

-
git pull-request [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]

Opens a pull request on GitHub for the project that the "origin" remote +

git pull-request [-o|--browse] [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]

Opens a pull request on GitHub for the project that the "origin" remote points to. The default head of the pull request is the current branch. Both base and head of the pull request can be explicitly given in one of the following formats: "branch", "owner:branch", "owner/repo:branch". @@ -196,6 +196,8 @@ on the remote. To skip this check, use -f.

of the pull request can be entered in the same manner as git commit message. Pull request message can also be passed via stdin with -F -.

+

With -o or --browse, the new pull request will open in the web browser.

+

Issue to pull request conversion via -i <ISSUE> or ISSUE-URL arguments is deprecated and will likely be removed from the future versions of both hub and GitHub API.

@@ -457,7 +459,7 @@ $ git help hub
  1. GITHUB
  2. -
  3. December 2013
  4. +
  5. February 2014
  6. hub(1)
diff --git a/man/hub.1.ronn b/man/hub.1.ronn index ea52b87b534369eb2e82de047bdaf108b52e64a6..fba3784ec3c110d3752a74591a78ebd2b9751044 100644 --- a/man/hub.1.ronn +++ b/man/hub.1.ronn @@ -27,7 +27,7 @@ hub(1) -- git + hub = github `git browse` [`-u`] [[`/`]] [SUBPAGE] `git compare` [`-u`] [] [[...]] `git fork` [`--no-remote`] -`git pull-request` [`-f`] [`-m` |`-F` |`-i` |] [`-b` ] [`-h` ] +`git pull-request` [`-o`|`--browse`] [`-f`] [`-m` |`-F` |`-i` |] [`-b` ] [`-h` ] `git ci-status` [`-v`] [] ## DESCRIPTION @@ -142,7 +142,7 @@ hub also adds some custom commands that are otherwise not present in git: Forks the original project (referenced by "origin" remote) on GitHub and adds a new remote for it under your username. - * `git pull-request` [`-f`] [`-m` |`-F` |`-i` |] [`-b` ] [`-h` ]: + * `git pull-request` [`-o`|`--browse`] [`-f`] [`-m` |`-F` |`-i` |] [`-b` ] [`-h` ]: Opens a pull request on GitHub for the project that the "origin" remote points to. The default head of the pull request is the current branch. Both base and head of the pull request can be explicitly given in one of @@ -155,6 +155,8 @@ hub also adds some custom commands that are otherwise not present in git: of the pull request can be entered in the same manner as git commit message. Pull request message can also be passed via stdin with `-F -`. + With `-o` or `--browse`, the new pull request will open in the web browser. + Issue to pull request conversion via `-i ` or arguments is deprecated and will likely be removed from the future versions of both hub and GitHub API. diff --git a/script/cached-bundle b/script/cached-bundle index 5b174ec6f19d08dc2bc980482a6136b894b28fab..80a0c95740d29e0d58dec096a4c2d05c761953c2 100755 --- a/script/cached-bundle +++ b/script/cached-bundle @@ -39,7 +39,7 @@ fi bundle "$@" -if [ ! -f "$cache_name" ]; then +if [ ! -f "$cache_name" ] && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then echo "Caching \`${bundle_path}' to S3" tar czf "$cache_name" "$bundle_path" script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${TRAVIS_REPO_SLUG}/${cache_name}" diff --git a/test/hub_test.rb b/test/hub_test.rb index c2f7905a2521d66bcf0c8fcc01877a67a0e82ab1..b3ce02d3b287ba3cb6b8e1601c3ba73c05647d34 100644 --- a/test/hub_test.rb +++ b/test/hub_test.rb @@ -410,7 +410,7 @@ class HubTest < Minitest::Test assert_equal expected, usage_help usage_help = hub("pull-request -h") - expected = "Usage: git pull-request [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]\n" + expected = "Usage: git pull-request [-o|--browse] [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]\n" assert_equal expected, usage_help end