Permalink
Browse files

Merge remote-tracking branch 'upstream/master' into get-pull-request

  • Loading branch information...
2 parents db76936 + 6976010 commit 6cb932ce46e308ba8805cb06e635ba07cb6d39ae @jianli committed Jun 12, 2013
View
@@ -1,5 +1,4 @@
*.swp
*~
/hub
-Gemfile.lock
tmp/
View
@@ -1,10 +1,11 @@
source 'https://rubygems.org'
-gem 'ronn'
+gem 'ronn', :platform => :mri
gem 'aruba'
gem 'cucumber'
gem 'sinatra'
-gem 'thin'
+gem 'thin', :platform => :mri
gem 'json'
+gem 'jruby-openssl', :platform => :jruby
gemspec
View
@@ -0,0 +1,84 @@
+PATH
+ remote: .
+ specs:
+ hub (1.10.6)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ addressable (2.3.2)
+ aruba (0.4.11)
+ childprocess (>= 0.2.3)
+ cucumber (>= 1.1.1)
+ ffi (>= 1.0.11)
+ rspec (>= 2.7.0)
+ bouncy-castle-java (1.5.0146.1)
+ builder (3.0.0)
+ childprocess (0.3.3)
+ ffi (~> 1.0.6)
+ crack (0.3.1)
+ cucumber (1.2.1)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.3)
+ gherkin (~> 2.11.0)
+ json (>= 1.4.6)
+ daemons (1.1.8)
+ diff-lcs (1.1.3)
+ eventmachine (0.12.10)
+ ffi (1.0.11)
+ ffi (1.0.11-java)
+ gherkin (2.11.1)
+ json (>= 1.4.6)
+ gherkin (2.11.1-java)
+ json (>= 1.4.6)
+ hpricot (0.8.4)
+ jruby-openssl (0.7.7)
+ bouncy-castle-java (>= 1.5.0146.1)
+ json (1.7.3)
+ json (1.7.3-java)
+ mustache (0.99.4)
+ rack (1.4.1)
+ rack-protection (1.2.0)
+ rack
+ rake (0.9.2.2)
+ rdiscount (1.6.8)
+ ronn (0.7.3)
+ hpricot (>= 0.8.2)
+ mustache (>= 0.7.0)
+ rdiscount (>= 1.5.8)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.0)
+ rspec-expectations (2.11.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.1)
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.3.3)
+ webmock (1.9.0)
+ addressable (>= 2.2.7)
+ crack (>= 0.1.7)
+
+PLATFORMS
+ java
+ ruby
+
+DEPENDENCIES
+ aruba
+ cucumber
+ hub!
+ jruby-openssl
+ json
+ rake
+ ronn
+ sinatra
+ thin
+ webmock
View
@@ -1,3 +1,39 @@
+## master
+
+* change `pull-request` interface to allow passing title & body
+* avoid hard breaks in `pull-request` message authored in Vim
+* save and reuse `pull-request` message if creating it failed
+* new `ci-status` command for checking GitHub Status API
+
+## 1.10.6 (2013-04-25)
+
+* compensate for new GitHub API enforcement
+* fix asking for password on Ruby <= 1.8.6
+* fix `fetch` for forks where username contains a dash
+
+## 1.10.5 (2013-03-02)
+
+* helpful `pull-request` error message when base project is invalid
+* fix `compare` for ranges containing "owner:branch" notation
+* enable `--name` argument for `submodule add`
+
+## 1.10.4 (2012-12-29)
+
+* fixes for Windows
+* display more validation errors on GitHub API failures
+* persist correctly capitalized GitHub login name
+
+## 1.10.3 (2012-11-22)
+
+* fix `browse` on Windows
+* fix hub on JRuby
+* try fixing Ruby 1.8.7 error with API requests
+* fix various edge cases around `create` command
+* have `fork` set up a remote even if own fork already exists
+* fix `pull-request` with Unicode chars on Ruby 1.8
+* respect $GITHUB_USER & $GITHUB_PASSWORD
+* improve reading git remotes configuration
+
## 1.10.2 (2012-07-24)
* fix pushing multiple refs to multiple remotes
View
@@ -48,6 +48,15 @@ git version 1.7.6
hub version 1.8.3
~~~
+#### On Windows
+
+If you have mysysgit, open "Git Bash" and follow the steps above but put the
+`hub` executable in `/bin` instead of `~/bin`.
+
+Avoid aliasing hub as `git` due to the fact that mysysgit automatically
+configures your prompt to include git information, and you want to avoid slowing
+that down. See [Is your shell prompt slow?](#is-your-shell-prompt-slow)
+
### RubyGems
Though not recommended, hub can also be installed as a RubyGem:
@@ -79,20 +88,49 @@ $ cd hub
$ rake install prefix=/usr/local
~~~
-### Help! It's Slow!
+### Help! It's slow!
+
+#### Is `hub` noticeably slower than plain git?
+
+That is inconvenient, especially if you want to alias hub as `git`. Few things
+you can try:
+
+* Find out which ruby is used for the hub executable:
+
+ ``` sh
+ head -1 `which hub`
+ ```
-Is your prompt slow? It may be hub.
+* That ruby should be speedy. Time it with:
-1. Check that it's **not** installed using RubyGems.
-2. Check that RUBYOPT isn't loading anything shady:
+ ``` sh
+ time /usr/bin/ruby -e0
+ #=> it should be below 0.01 s total
+ ```
- $ echo $RUBYOPT
+* Check that Ruby isn't loading something shady:
-3. Check that your system Ruby is speedy:
+ ``` sh
+ echo $RUBYOPT
+ ```
- $ time /usr/bin/env ruby -e0
+* Check your [GC settings][gc]
-If #3 is slow, it may be your [GC settings][gc].
+General recommendation: you should change hub's shebang line to run with system
+ruby (usually `/usr/bin/ruby`) instead of currently active ruby (`/usr/bin/env
+ruby`). Also, Ruby 1.8 is speedier than 1.9.
+
+#### Is your shell prompt slow?
+
+Does your prompt show git information? Hub may be slowing down your prompt.
+
+This can happen if you've aliased hub as `git`. This is fine when you use `git`
+manually, but may be unacceptable for your prompt, which doesn't need hub
+features anyway!
+
+The solution is to identify which shell functions are calling `git`, and replace
+each occurrence of that with `command git`. This is a shell feature that enables
+you to call a command directly and skip aliases and functions wrapping it.
Aliasing
@@ -200,7 +238,7 @@ superpowers:
[ opened pull request on GitHub for "YOUR_USER:feature" ]
# explicit title, pull base & head:
- $ git pull-request "I've implemented feature X" -b defunkt:master -h mislav:feature
+ $ git pull-request -m "Implemented feature X" -b defunkt:master -h mislav:feature
$ git pull-request -i 123
[ attached pull request to issue #123 ]
@@ -294,8 +332,14 @@ superpowers:
$ hub submodule add -p wycats/bundler vendor/bundler
> git submodule add git@github.com:wycats/bundler.git vendor/bundler
- $ hub submodule add -b ryppl ryppl/pip vendor/pip
- > git submodule add -b ryppl git://github.com/ryppl/pip.git vendor/pip
+ $ hub submodule add -b ryppl --name pip ryppl/pip vendor/pip
+ > git submodule add -b ryppl --name pip git://github.com/ryppl/pip.git vendor/pip
+
+### git ci-status
+
+ $ hub ci-status [commit]
+ > (prints CI state of commit and exits with appropriate code)
+ > One of: success (0), error (1), failure (1), pending (2), no status (3)
### git help
View
@@ -152,17 +152,17 @@ task :homebrew do
sh 'git pull -q origin master'
formula_file = 'Library/Formula/hub.rb'
- md5 = `curl -#L https://github.com/defunkt/hub/tarball/v#{Hub::VERSION} | md5`.chomp
- abort unless $?.success? and md5.length == 32
+ sha = `curl -fsSL https://github.com/defunkt/hub/tarball/v#{Hub::VERSION} | shasum`.split(/\s+/).first
+ abort unless $?.success? and sha.length == 40
formula = File.read formula_file
formula.sub! /\bv\d+(\.\d+)*/, "v#{Hub::VERSION}"
- formula.sub! /\b[0-9a-f]{32}\b/, md5
+ formula.sub! /\b[0-9a-f]{40}\b/, sha
File.open(formula_file, 'w') {|f| f << formula }
branch = "hub-v#{Hub::VERSION}"
sh "git checkout -q -B #{branch}"
- sh "git commit -m 'upgrade hub to v#{Hub::VERSION}' -- #{formula_file}"
+ sh "git commit -m 'hub v#{Hub::VERSION}' -- #{formula_file}"
sh "git push -u mislav #{branch}"
sh "hub pull-request 'upgrade hub to v#{Hub::VERSION}'"
@@ -10,17 +10,25 @@ Feature: OAuth authentication
post('/authorizations') {
auth = Rack::Auth::Basic::Request.new(env)
halt 401 unless auth.credentials == %w[mislav kitty]
- halt 400 unless params[:scopes] == ['repo']
+ assert :scopes => ['repo']
json :token => 'OTOKEN'
}
- post('/user/repos') { status 200 }
+ get('/user') {
+ halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
+ json :login => 'MiSlAv'
+ }
+ post('/user/repos') {
+ halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
+ 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 username:"
And 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 "user: MiSlAv"
And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
And the file "../home/.config/hub" should have mode "0600"
@@ -36,7 +44,12 @@ Feature: OAuth authentication
{:token => 'OTOKEN', :app => {:url => 'http://defunkt.io/hub/'}}
]
}
- post('/user/repos') { status 200 }
+ get('/user') {
+ json :login => 'mislav'
+ }
+ post('/user/repos') {
+ json :full_name => 'mislav/dotfiles'
+ }
"""
When I run `hub create` interactively
When I type "mislav"
@@ -45,6 +58,30 @@ Feature: OAuth authentication
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:
+ """
+ require 'rack/auth/basic'
+ get('/authorizations') {
+ auth = Rack::Auth::Basic::Request.new(env)
+ halt 401 unless auth.credentials == %w[mislav kitty]
+ json [
+ {:token => 'OTOKEN', :app => {:url => 'http://defunkt.io/hub/'}}
+ ]
+ }
+ get('/user') {
+ json :login => 'mislav'
+ }
+ post('/user/repos') {
+ json :full_name => 'mislav/dotfiles'
+ }
+ """
+ Given $GITHUB_USER is "mislav"
+ And $GITHUB_PASSWORD is "kitty"
+ When I successfully run `hub create`
+ Then the output should not contain "github.com password for mislav"
+ And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
+
Scenario: Wrong password
Given the GitHub API server:
"""
View
@@ -59,6 +59,12 @@ Feature: hub browse
When I successfully run `hub browse`
Then "open https://github.com/mislav/dotfiles" should be run
+ Scenario: Current branch with special chars
+ Given I am in "git://github.com/mislav/dotfiles.git" git repo
+ And I am on the "fix-bug-#123" branch with upstream "origin/fix-bug-#123"
+ When I successfully run `hub browse`
+ Then "open https://github.com/mislav/dotfiles/tree/fix-bug-%23123" should be run
+
Scenario: Commits on current branch
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And I am on the "feature" branch with upstream "origin/experimental"
@@ -67,9 +73,9 @@ Feature: hub browse
Scenario: Complex branch
Given I am in "git://github.com/mislav/dotfiles.git" git repo
- And I am on the "foo/bar" branch with upstream "origin/baz/qux"
+ And I am on the "foo/bar" branch with upstream "origin/baz/qux/moo"
When I successfully run `hub browse`
- Then "open https://github.com/mislav/dotfiles/tree/baz/qux" should be run
+ Then "open https://github.com/mislav/dotfiles/tree/baz/qux/moo" should be run
Scenario: Wiki repo
Given I am in "git://github.com/defunkt/hub.wiki.git" git repo
Oops, something went wrong.

0 comments on commit 6cb932c

Please sign in to comment.