hub 1.12.3 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -6
- data/Rakefile +7 -1
- data/lib/hub/commands.rb +14 -7
- data/lib/hub/github_api.rb +34 -21
- data/lib/hub/speedy_stdlib.rb +21 -10
- data/lib/hub/version.rb +1 -1
- data/man/hub.1 +4 -4
- data/man/hub.1.html +4 -4
- data/man/hub.1.ronn +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb7e38c89dc87f9e05027c6f4d0bd062783352ab
|
4
|
+
data.tar.gz: f7642761346978a2a7d1fce314c1c3116cc32311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 109f3785e3159fa9b6f1ab597d7f8ef001c0be3b66434c95cd8e833342e7e22007965ce7fdc79edda44a491b1eb07a8b09c2edaada22e971a39b5c8407ddf963
|
7
|
+
data.tar.gz: 79bec54832b2b6fa32e8b363d5911e795df7b1c54b9de7eb373fc5534fbcf57be0e07b66def7bb37be30598e0d72c237be94d158585c700a79a468fa06b832c9
|
data/README.md
CHANGED
@@ -38,19 +38,17 @@ supports hub is available:
|
|
38
38
|
|
39
39
|
~~~ sh
|
40
40
|
# Download or clone the project from GitHub:
|
41
|
-
$ git clone git://github.com/github/hub.git
|
41
|
+
$ git clone git://github.com/github/hub.git -b 1.12-stable
|
42
42
|
$ cd hub
|
43
|
-
$ rake install
|
43
|
+
$ rake install PREFIX=/usr/local
|
44
44
|
~~~
|
45
45
|
|
46
|
-
On a Unix-based OS, this installs under `PREFIX`, which is `/usr/local` by default.
|
47
|
-
|
48
46
|
Now you should be ready to roll:
|
49
47
|
|
50
48
|
~~~ sh
|
51
49
|
$ hub version
|
52
|
-
git version 1.
|
53
|
-
hub version 1.
|
50
|
+
git version 2.1.4
|
51
|
+
hub version 1.12.4
|
54
52
|
~~~
|
55
53
|
|
56
54
|
#### Windows "Git Bash" (msysGit) note
|
data/Rakefile
CHANGED
@@ -151,7 +151,13 @@ task :pages => :gh_pages do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
task :gem_release do
|
154
|
-
|
154
|
+
require File.expand_path('../lib/hub/version', __FILE__)
|
155
|
+
# sh "git add lib/hub/version.rb"
|
156
|
+
# sh "git commit -m 'hub #{Hub::VERSION}'"
|
157
|
+
# sh "git tag v#{Hub::VERSION}"
|
158
|
+
sh "RUBYOPT= git push origin HEAD v#{Hub::VERSION}"
|
159
|
+
sh "gem build hub.gemspec"
|
160
|
+
sh "gem push hub-#{Hub::VERSION}.gem"
|
155
161
|
end
|
156
162
|
|
157
163
|
desc "Publish to Homebrew"
|
data/lib/hub/commands.rb
CHANGED
@@ -359,6 +359,11 @@ module Hub
|
|
359
359
|
args.pop
|
360
360
|
end
|
361
361
|
|
362
|
+
if user.downcase == github_user.downcase
|
363
|
+
user = github_user
|
364
|
+
ssh = true
|
365
|
+
end
|
366
|
+
|
362
367
|
args << git_url(user, repo, :private => ssh)
|
363
368
|
end
|
364
369
|
|
@@ -704,9 +709,9 @@ module Hub
|
|
704
709
|
|
705
710
|
path = case subpage
|
706
711
|
when 'commits'
|
707
|
-
"/commits/#{branch_in_url(branch)}"
|
712
|
+
"/commits/#{branch_in_url(branch.short_name)}"
|
708
713
|
when 'tree', NilClass
|
709
|
-
"/tree/#{branch_in_url(branch)}" if branch and !branch.master?
|
714
|
+
"/tree/#{branch_in_url(branch.short_name)}" if branch and !branch.master?
|
710
715
|
else
|
711
716
|
"/#{subpage}"
|
712
717
|
end
|
@@ -742,7 +747,8 @@ module Hub
|
|
742
747
|
end
|
743
748
|
end
|
744
749
|
|
745
|
-
|
750
|
+
escaped_range = range.include?('..') ? range : branch_in_url(range)
|
751
|
+
path = '/compare/%s' % escaped_range
|
746
752
|
project.web_url(path, api_client.config.method(:protocol))
|
747
753
|
end
|
748
754
|
end
|
@@ -842,8 +848,10 @@ module Hub
|
|
842
848
|
# from the command line.
|
843
849
|
#
|
844
850
|
|
845
|
-
def branch_in_url(
|
846
|
-
|
851
|
+
def branch_in_url(branch_name)
|
852
|
+
branch_name.to_str.gsub(/[^\w!.*'():^~\/-]/) do |char|
|
853
|
+
'%' + char.unpack('H2' * char.bytesize).join('%').upcase
|
854
|
+
end
|
847
855
|
end
|
848
856
|
|
849
857
|
def api_client
|
@@ -1157,8 +1165,7 @@ help
|
|
1157
1165
|
|
1158
1166
|
def display_api_exception(action, response)
|
1159
1167
|
$stderr.puts "Error #{action}: #{response.message.strip} (HTTP #{response.status})"
|
1160
|
-
if
|
1161
|
-
# display validation errors
|
1168
|
+
if [401, 403, 422].include?(response.status) && response.error_message?
|
1162
1169
|
msg = response.error_message
|
1163
1170
|
msg = msg.join("\n") if msg.respond_to? :join
|
1164
1171
|
warn msg
|
data/lib/hub/github_api.rb
CHANGED
@@ -333,36 +333,49 @@ module Hub
|
|
333
333
|
end
|
334
334
|
end
|
335
335
|
|
336
|
-
def obtain_oauth_token host, user
|
336
|
+
def obtain_oauth_token host, user
|
337
337
|
auth_url = URI.parse("https://%s@%s/authorizations" % [CGI.escape(user), host])
|
338
|
+
auth_params = {
|
339
|
+
:scopes => ['repo'],
|
340
|
+
:note => "hub for #{local_user}@#{local_hostname}",
|
341
|
+
:note_url => oauth_app_url
|
342
|
+
}
|
343
|
+
res = nil
|
344
|
+
two_factor_code = nil
|
338
345
|
|
339
|
-
|
340
|
-
|
346
|
+
loop do
|
347
|
+
res = post(auth_url, auth_params) do |req|
|
348
|
+
req['X-GitHub-OTP'] = two_factor_code if two_factor_code
|
349
|
+
end
|
341
350
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
unless res.success?
|
347
|
-
if !two_factor_code && res['X-GitHub-OTP'].to_s.include?('required')
|
351
|
+
if res.success?
|
352
|
+
break
|
353
|
+
elsif res.status == 401 && res['X-GitHub-OTP'].to_s.include?('required')
|
354
|
+
$stderr.puts "warning: invalid two-factor code" if two_factor_code
|
348
355
|
two_factor_code = config.prompt_auth_code
|
349
|
-
|
356
|
+
elsif res.status == 422 && 'already_exists' == res.data['errors'][0]['code']
|
357
|
+
if auth_params[:note] =~ / (\d+)$/
|
358
|
+
res.error! if $1.to_i >= 9
|
359
|
+
auth_params[:note].succ!
|
360
|
+
else
|
361
|
+
auth_params[:note] += ' 2'
|
362
|
+
end
|
350
363
|
else
|
351
364
|
res.error!
|
352
365
|
end
|
353
366
|
end
|
354
367
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
368
|
+
res.data['token']
|
369
|
+
end
|
370
|
+
|
371
|
+
def local_user
|
372
|
+
require 'etc'
|
373
|
+
Etc.getlogin
|
374
|
+
end
|
375
|
+
|
376
|
+
def local_hostname
|
377
|
+
require 'socket'
|
378
|
+
Socket.gethostname
|
366
379
|
end
|
367
380
|
end
|
368
381
|
|
data/lib/hub/speedy_stdlib.rb
CHANGED
@@ -38,7 +38,19 @@ unless defined?(URI)
|
|
38
38
|
InvalidComponentError = Class.new(Error)
|
39
39
|
|
40
40
|
def self.parse(str)
|
41
|
-
|
41
|
+
m = str.to_s.match(%r{^ ([\w-]+): // (?:([^/@]+)@)? ([^/?#]+) }x)
|
42
|
+
raise InvalidURIError unless m
|
43
|
+
|
44
|
+
_, scheme, userinfo, host = m.to_a
|
45
|
+
default_port = scheme == 'https' ? 443 : 80
|
46
|
+
host, port = host.split(':', 2)
|
47
|
+
port = port ? port.to_i : default_port
|
48
|
+
|
49
|
+
path, fragment = m.post_match.split('#', 2)
|
50
|
+
path, query = path.split('?', 2) if path
|
51
|
+
path = path.to_s
|
52
|
+
|
53
|
+
URI::HTTP.new(scheme, userinfo, host, port, nil, path, nil, query, fragment)
|
42
54
|
end
|
43
55
|
|
44
56
|
def self.encode_www_form(params)
|
@@ -61,15 +73,14 @@ unless defined?(URI)
|
|
61
73
|
attr_reader :port
|
62
74
|
alias hostname host
|
63
75
|
|
64
|
-
def initialize(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
self.
|
69
|
-
self.
|
70
|
-
|
71
|
-
|
72
|
-
self.path = path.to_s
|
76
|
+
def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, *extra)
|
77
|
+
self.scheme = scheme
|
78
|
+
self.userinfo = userinfo
|
79
|
+
self.host = host
|
80
|
+
self.port = port
|
81
|
+
self.path = path
|
82
|
+
self.query = query
|
83
|
+
self.fragment = fragment
|
73
84
|
end
|
74
85
|
|
75
86
|
def to_s
|
data/lib/hub/version.rb
CHANGED
data/man/hub.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "HUB" "1" "
|
4
|
+
.TH "HUB" "1" "December 2014" "GITHUB" "Hub Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBhub\fR \- git + hub = github
|
@@ -52,7 +52,7 @@
|
|
52
52
|
\fBgit create\fR [\fINAME\fR] [\fB\-p\fR] [\fB\-d\fR \fIDESCRIPTION\fR] [\fB\-h\fR \fIHOMEPAGE\fR]
|
53
53
|
.
|
54
54
|
.br
|
55
|
-
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR
|
55
|
+
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR|\-\- [SUBPAGE]]
|
56
56
|
.
|
57
57
|
.br
|
58
58
|
\fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [[\fISTART\fR\.\.\.]\fIEND\fR]
|
@@ -136,7 +136,7 @@ hub also adds some custom commands that are otherwise not present in git:
|
|
136
136
|
Create a new public GitHub repository from the current git repository and add remote \fBorigin\fR at "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"; \fIUSER\fR is your GitHub username and \fIREPOSITORY\fR is the current working directory name\. To explicitly name the new repository, pass in \fINAME\fR, optionally in \fIORGANIZATION\fR/\fINAME\fR form to create under an organization you\'re a member of\. With \fB\-p\fR, create a private repository, and with \fB\-d\fR and \fB\-h\fR set the repository\'s description and homepage URL, respectively\.
|
137
137
|
.
|
138
138
|
.TP
|
139
|
-
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR
|
139
|
+
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR|\-\- [SUBPAGE]]
|
140
140
|
Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\. With \fB\-u\fR, outputs the URL rather than opening the browser\.
|
141
141
|
.
|
142
142
|
.TP
|
@@ -327,7 +327,7 @@ $ git pull\-request \-m "Implemented feature X" \-b defunkt:master \-h mislav:fe
|
|
327
327
|
.nf
|
328
328
|
|
329
329
|
$ git checkout https://github\.com/defunkt/hub/pull/73
|
330
|
-
> git remote add \-f \-t feature git://github
|
330
|
+
> git remote add \-f \-t feature mislav git://github\.com/mislav/hub\.git
|
331
331
|
> git checkout \-\-track \-B mislav\-feature mislav/feature
|
332
332
|
|
333
333
|
$ git checkout https://github\.com/defunkt/hub/pull/73 custom\-branch\-name
|
data/man/hub.1.html
CHANGED
@@ -97,7 +97,7 @@
|
|
97
97
|
<h3 id="Custom-git-commands-">Custom git commands:</h3>
|
98
98
|
|
99
99
|
<p><code>git create</code> [<var>NAME</var>] [<code>-p</code>] [<code>-d</code> <var>DESCRIPTION</var>] [<code>-h</code> <var>HOMEPAGE</var>]<br />
|
100
|
-
<code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var
|
100
|
+
<code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>|-- [SUBPAGE]]<br />
|
101
101
|
<code>git compare</code> [<code>-u</code>] [<var>USER</var>] [[<var>START</var>...]<var>END</var>]<br />
|
102
102
|
<code>git fork</code> [<code>--no-remote</code>]<br />
|
103
103
|
<code>git pull-request</code> [<code>-o</code>|<code>--browse</code>] [<code>-f</code>] [<code>-m</code> <var>MESSAGE</var>|<code>-F</code> <var>FILE</var>|<code>-i</code> <var>ISSUE</var>|<var>ISSUE-URL</var>] [<code>-b</code> <var>BASE</var>] [<code>-h</code> <var>HEAD</var>]<br />
|
@@ -169,7 +169,7 @@ To explicitly name the new repository, pass in <var>NAME</var>, optionally in
|
|
169
169
|
<var>ORGANIZATION</var>/<var>NAME</var> form to create under an organization you're a
|
170
170
|
member of. With <code>-p</code>, create a private repository, and with <code>-d</code> and <code>-h</code>
|
171
171
|
set the repository's description and homepage URL, respectively.</p></dd>
|
172
|
-
<dt><code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var
|
172
|
+
<dt><code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>|-- [SUBPAGE]]</dt><dd><p>Open repository's GitHub page in the system's default web browser using
|
173
173
|
<code>open(1)</code> or the <code>BROWSER</code> env variable. If the repository isn't
|
174
174
|
specified, <code>browse</code> opens the page of the repository found in the current
|
175
175
|
directory. If SUBPAGE is specified, the browser will open on the specified
|
@@ -330,7 +330,7 @@ $ git pull-request -m "Implemented feature X" -b defunkt:master -h mislav:featur
|
|
330
330
|
<h3 id="git-checkout">git checkout</h3>
|
331
331
|
|
332
332
|
<pre><code>$ git checkout https://github.com/defunkt/hub/pull/73
|
333
|
-
> git remote add -f -t feature git://github
|
333
|
+
> git remote add -f -t feature mislav git://github.com/mislav/hub.git
|
334
334
|
> git checkout --track -B mislav-feature mislav/feature
|
335
335
|
|
336
336
|
$ git checkout https://github.com/defunkt/hub/pull/73 custom-branch-name
|
@@ -459,7 +459,7 @@ $ git help hub
|
|
459
459
|
|
460
460
|
<ol class='man-decor man-foot man foot'>
|
461
461
|
<li class='tl'>GITHUB</li>
|
462
|
-
<li class='tc'>
|
462
|
+
<li class='tc'>December 2014</li>
|
463
463
|
<li class='tr'>hub(1)</li>
|
464
464
|
</ol>
|
465
465
|
|
data/man/hub.1.ronn
CHANGED
@@ -24,7 +24,7 @@ hub(1) -- git + hub = github
|
|
24
24
|
### Custom git commands:
|
25
25
|
|
26
26
|
`git create` [<NAME>] [`-p`] [`-d` <DESCRIPTION>] [`-h` <HOMEPAGE>]
|
27
|
-
`git browse` [`-u`] [[<USER>`/`]<REPOSITORY
|
27
|
+
`git browse` [`-u`] [[<USER>`/`]<REPOSITORY>|-- [SUBPAGE]]
|
28
28
|
`git compare` [`-u`] [<USER>] [[<START>...]<END>]
|
29
29
|
`git fork` [`--no-remote`]
|
30
30
|
`git pull-request` [`-o`|`--browse`] [`-f`] [`-m` <MESSAGE>|`-F` <FILE>|`-i` <ISSUE>|<ISSUE-URL>] [`-b` <BASE>] [`-h` <HEAD>]
|
@@ -121,7 +121,7 @@ hub also adds some custom commands that are otherwise not present in git:
|
|
121
121
|
member of. With `-p`, create a private repository, and with `-d` and `-h`
|
122
122
|
set the repository's description and homepage URL, respectively.
|
123
123
|
|
124
|
-
* `git browse` [`-u`] [[<USER>`/`]<REPOSITORY
|
124
|
+
* `git browse` [`-u`] [[<USER>`/`]<REPOSITORY>|-- [SUBPAGE]]:
|
125
125
|
Open repository's GitHub page in the system's default web browser using
|
126
126
|
`open(1)` or the `BROWSER` env variable. If the repository isn't
|
127
127
|
specified, `browse` opens the page of the repository found in the current
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |2
|
15
15
|
`hub` is a command line utility which adds GitHub knowledge to `git`.
|