hub 1.10.6 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of hub might be problematic. Click here for more details.
- data/README.md +30 -62
- data/Rakefile +24 -15
- data/bin/bench +37 -0
- data/lib/hub.rb +1 -0
- data/lib/hub/commands.rb +178 -57
- data/lib/hub/context.rb +63 -20
- data/lib/hub/github_api.rb +193 -71
- data/lib/hub/speedy_stdlib.rb +107 -0
- data/lib/hub/ssh_config.rb +1 -1
- data/lib/hub/standalone.rb +31 -3
- data/lib/hub/version.rb +1 -1
- data/man/hub.1 +46 -23
- data/man/hub.1.html +46 -29
- data/man/hub.1.ronn +30 -15
- data/script/cached-bundle +46 -0
- data/script/s3-put +71 -0
- data/script/test +41 -0
- data/script/test_each +9 -0
- data/test/context_test.rb +79 -0
- data/test/fakebin/git +1 -1
- data/test/fakebin/open +2 -2
- data/test/github_api_test.rb +79 -0
- data/test/helper.rb +2 -2
- data/test/hub_test.rb +85 -197
- data/test/standalone_test.rb +6 -2
- metadata +22 -15
- data/HISTORY.md +0 -244
data/test/hub_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'helper'
|
2
|
-
require 'webmock/
|
2
|
+
require 'webmock/minitest'
|
3
3
|
require 'rbconfig'
|
4
4
|
require 'yaml'
|
5
5
|
require 'forwardable'
|
@@ -19,7 +19,7 @@ WebMock::BodyPattern.class_eval do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class HubTest < Test
|
22
|
+
class HubTest < Minitest::Test
|
23
23
|
extend Forwardable
|
24
24
|
|
25
25
|
if defined? WebMock::API
|
@@ -83,10 +83,19 @@ class HubTest < Test::Unit::TestCase
|
|
83
83
|
'symbolic-ref -q HEAD' => 'refs/heads/master',
|
84
84
|
'remote -v' => "origin\tgit://github.com/defunkt/hub.git (fetch)\nmislav\tgit://github.com/mislav/hub.git (fetch)",
|
85
85
|
'rev-parse --symbolic-full-name master@{upstream}' => 'refs/remotes/origin/master',
|
86
|
+
'rev-parse --symbolic-full-name origin' => 'refs/remotes/origin/master',
|
86
87
|
'config --get --bool hub.http-clone' => 'false',
|
87
88
|
'config --get hub.protocol' => nil,
|
88
89
|
'config --get-all hub.host' => nil,
|
90
|
+
'config --get push.default' => nil,
|
89
91
|
'rev-parse -q --git-dir' => '.git'
|
92
|
+
|
93
|
+
stub_remote_branch('origin/master')
|
94
|
+
end
|
95
|
+
|
96
|
+
def teardown
|
97
|
+
super
|
98
|
+
WebMock.reset!
|
90
99
|
end
|
91
100
|
|
92
101
|
def test_cherry_pick
|
@@ -139,17 +148,23 @@ class HubTest < Test::Unit::TestCase
|
|
139
148
|
end
|
140
149
|
|
141
150
|
def test_am_pull_request
|
151
|
+
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/55").
|
152
|
+
with(:headers => {'Accept'=>'application/vnd.github.v3.patch', 'Authorization'=>'token OTOKEN'}).
|
153
|
+
to_return(:status => 200)
|
154
|
+
|
142
155
|
with_tmpdir('/tmp/') do
|
143
|
-
assert_commands "
|
144
|
-
"git am --signoff /tmp/55.patch -p2",
|
156
|
+
assert_commands "git am --signoff /tmp/55.patch -p2",
|
145
157
|
"am --signoff https://github.com/defunkt/hub/pull/55#comment_123 -p2"
|
146
158
|
|
147
159
|
cmd = Hub("am https://github.com/defunkt/hub/pull/55/files").command
|
148
|
-
assert_includes '/
|
160
|
+
assert_includes '/tmp/55.patch', cmd
|
149
161
|
end
|
150
162
|
end
|
151
163
|
|
152
164
|
def test_am_no_tmpdir
|
165
|
+
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/55").
|
166
|
+
to_return(:status => 200)
|
167
|
+
|
153
168
|
with_tmpdir(nil) do
|
154
169
|
cmd = Hub("am https://github.com/defunkt/hub/pull/55").command
|
155
170
|
assert_includes '/tmp/55.patch', cmd
|
@@ -157,21 +172,34 @@ class HubTest < Test::Unit::TestCase
|
|
157
172
|
end
|
158
173
|
|
159
174
|
def test_am_commit_url
|
175
|
+
stub_request(:get, "https://api.github.com/repos/davidbalbert/hub/commits/fdb9921").
|
176
|
+
with(:headers => {'Accept'=>'application/vnd.github.v3.patch', 'Authorization'=>'token OTOKEN'}).
|
177
|
+
to_return(:status => 200)
|
178
|
+
|
160
179
|
with_tmpdir('/tmp/') do
|
161
180
|
url = 'https://github.com/davidbalbert/hub/commit/fdb9921'
|
162
|
-
|
163
|
-
assert_commands "curl -#LA 'hub #{Hub::Version}' #{url}.patch -o /tmp/fdb9921.patch",
|
164
|
-
"git am --signoff /tmp/fdb9921.patch -p2",
|
181
|
+
assert_commands "git am --signoff /tmp/fdb9921.patch -p2",
|
165
182
|
"am --signoff #{url} -p2"
|
166
183
|
end
|
167
184
|
end
|
168
185
|
|
169
186
|
def test_am_gist
|
187
|
+
stub_request(:get, "https://api.github.com/gists/8da7fb575debd88c54cf").
|
188
|
+
with(:headers => {'Authorization'=>'token OTOKEN'}).
|
189
|
+
to_return(:body => Hub::JSON.generate(:files => {
|
190
|
+
'file.diff' => {
|
191
|
+
:raw_url => "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff"
|
192
|
+
}
|
193
|
+
}))
|
194
|
+
|
195
|
+
stub_request(:get, "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff").
|
196
|
+
with(:headers => {'Accept'=>'text/plain'}).
|
197
|
+
to_return(:status => 200)
|
198
|
+
|
170
199
|
with_tmpdir('/tmp/') do
|
171
200
|
url = 'https://gist.github.com/8da7fb575debd88c54cf'
|
172
201
|
|
173
|
-
assert_commands "
|
174
|
-
"git am --signoff /tmp/gist-8da7fb575debd88c54cf.txt -p2",
|
202
|
+
assert_commands "git am --signoff /tmp/gist-8da7fb575debd88c54cf.txt -p2",
|
175
203
|
"am --signoff #{url} -p2"
|
176
204
|
end
|
177
205
|
end
|
@@ -181,32 +209,46 @@ class HubTest < Test::Unit::TestCase
|
|
181
209
|
end
|
182
210
|
|
183
211
|
def test_apply_pull_request
|
212
|
+
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/55").
|
213
|
+
to_return(:status => 200)
|
214
|
+
|
184
215
|
with_tmpdir('/tmp/') do
|
185
|
-
assert_commands "
|
186
|
-
"git apply /tmp/55.patch -p2",
|
216
|
+
assert_commands "git apply /tmp/55.patch -p2",
|
187
217
|
"apply https://github.com/defunkt/hub/pull/55 -p2"
|
188
218
|
|
189
219
|
cmd = Hub("apply https://github.com/defunkt/hub/pull/55/files").command
|
190
|
-
assert_includes '/
|
220
|
+
assert_includes '/tmp/55.patch', cmd
|
191
221
|
end
|
192
222
|
end
|
193
223
|
|
194
224
|
def test_apply_commit_url
|
225
|
+
stub_request(:get, "https://api.github.com/repos/davidbalbert/hub/commits/fdb9921").
|
226
|
+
to_return(:status => 200)
|
227
|
+
|
195
228
|
with_tmpdir('/tmp/') do
|
196
229
|
url = 'https://github.com/davidbalbert/hub/commit/fdb9921'
|
197
230
|
|
198
|
-
assert_commands "
|
199
|
-
"git apply /tmp/fdb9921.patch -p2",
|
231
|
+
assert_commands "git apply /tmp/fdb9921.patch -p2",
|
200
232
|
"apply #{url} -p2"
|
201
233
|
end
|
202
234
|
end
|
203
235
|
|
204
236
|
def test_apply_gist
|
237
|
+
stub_request(:get, "https://api.github.com/gists/8da7fb575debd88c54cf").
|
238
|
+
with(:headers => {'Authorization'=>'token OTOKEN'}).
|
239
|
+
to_return(:body => Hub::JSON.generate(:files => {
|
240
|
+
'file.diff' => {
|
241
|
+
:raw_url => "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff"
|
242
|
+
}
|
243
|
+
}))
|
244
|
+
|
245
|
+
stub_request(:get, "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff").
|
246
|
+
to_return(:status => 200)
|
247
|
+
|
205
248
|
with_tmpdir('/tmp/') do
|
206
|
-
url = 'https://gist.github.com/8da7fb575debd88c54cf'
|
249
|
+
url = 'https://gist.github.com/mislav/8da7fb575debd88c54cf'
|
207
250
|
|
208
|
-
assert_commands "
|
209
|
-
"git apply /tmp/gist-8da7fb575debd88c54cf.txt -p2",
|
251
|
+
assert_commands "git apply /tmp/gist-8da7fb575debd88c54cf.txt -p2",
|
210
252
|
"apply #{url} -p2"
|
211
253
|
end
|
212
254
|
end
|
@@ -257,71 +299,24 @@ class HubTest < Test::Unit::TestCase
|
|
257
299
|
"push origin,staging master new-feature"
|
258
300
|
end
|
259
301
|
|
260
|
-
def test_pullrequest
|
261
|
-
expected = "Aborted: head branch is the same as base (\"master\")\n" <<
|
262
|
-
"(use `-h <branch>` to specify an explicit pull request head)\n"
|
263
|
-
assert_output expected, "pull-request hereyougo"
|
264
|
-
end
|
265
|
-
|
266
|
-
def test_pullrequest_with_unpushed_commits
|
267
|
-
stub_tracking('master', 'mislav', 'master')
|
268
|
-
stub_command_output "rev-list --cherry-pick --right-only --no-merges mislav/master...", "+abcd1234\n+bcde2345"
|
269
|
-
|
270
|
-
expected = "Aborted: 2 commits are not yet pushed to mislav/master\n" <<
|
271
|
-
"(use `-f` to force submit a pull request anyway)\n"
|
272
|
-
assert_output expected, "pull-request hereyougo"
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_pullrequest_from_branch
|
276
|
-
stub_branch('refs/heads/feature')
|
277
|
-
stub_tracking_nothing('feature')
|
278
|
-
|
279
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
280
|
-
with(:body => { 'base' => "master", 'head' => "tpw:feature", 'title' => "hereyougo" }) { |req|
|
281
|
-
req.headers['Content-Length'] == 63
|
282
|
-
}.to_return(:body => mock_pullreq_response(1))
|
283
|
-
|
284
|
-
expected = "https://github.com/defunkt/hub/pull/1\n"
|
285
|
-
assert_output expected, "pull-request hereyougo -f"
|
286
|
-
end
|
287
|
-
|
288
|
-
def test_pullrequest_from_tracking_branch
|
289
|
-
stub_branch('refs/heads/feature')
|
290
|
-
stub_tracking('feature', 'mislav', 'yay-feature')
|
291
|
-
|
292
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
293
|
-
with(:body => {'base' => "master", 'head' => "mislav:yay-feature", 'title' => "hereyougo" }).
|
294
|
-
to_return(:body => mock_pullreq_response(1))
|
295
|
-
|
296
|
-
expected = "https://github.com/defunkt/hub/pull/1\n"
|
297
|
-
assert_output expected, "pull-request hereyougo -f"
|
298
|
-
end
|
299
|
-
|
300
302
|
def test_pullrequest_from_branch_tracking_local
|
303
|
+
stub_config_value 'push.default', 'upstream'
|
301
304
|
stub_branch('refs/heads/feature')
|
302
305
|
stub_tracking('feature', 'refs/heads/master')
|
303
306
|
|
304
307
|
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
305
|
-
with(:body => {'base' => "master", 'head' => "
|
308
|
+
with(:body => {'base' => "master", 'head' => "defunkt:feature", 'title' => "hereyougo" }).
|
306
309
|
to_return(:body => mock_pullreq_response(1))
|
307
310
|
|
308
311
|
expected = "https://github.com/defunkt/hub/pull/1\n"
|
309
|
-
assert_output expected, "pull-request hereyougo -f"
|
310
|
-
end
|
311
|
-
|
312
|
-
def test_pullrequest_invalid_remote
|
313
|
-
stub_repo_url('gh:singingwolfboy/sekrit.git')
|
314
|
-
stub_branch('refs/heads/feature')
|
315
|
-
stub_tracking('feature', 'origin', 'feature')
|
316
|
-
|
317
|
-
expected = "Aborted: the origin remote doesn't point to a GitHub repository.\n"
|
318
|
-
assert_output expected, "pull-request hereyougo"
|
312
|
+
assert_output expected, "pull-request -m hereyougo -f"
|
319
313
|
end
|
320
314
|
|
321
315
|
def test_pullrequest_enterprise_no_tracking
|
322
316
|
stub_hub_host('git.my.org')
|
323
317
|
stub_repo_url('git@git.my.org:defunkt/hub.git')
|
324
318
|
stub_branch('refs/heads/feature')
|
319
|
+
stub_remote_branch('origin/feature')
|
325
320
|
stub_tracking_nothing('feature')
|
326
321
|
stub_command_output "rev-list --cherry-pick --right-only --no-merges origin/feature...", nil
|
327
322
|
edit_hub_config do |data|
|
@@ -329,136 +324,16 @@ class HubTest < Test::Unit::TestCase
|
|
329
324
|
end
|
330
325
|
|
331
326
|
stub_request(:post, "https://git.my.org/api/v3/repos/defunkt/hub/pulls").
|
332
|
-
with(:body => {'base' => "master", 'head' => "
|
327
|
+
with(:body => {'base' => "master", 'head' => "defunkt:feature", 'title' => "hereyougo" }).
|
333
328
|
to_return(:body => mock_pullreq_response(1, 'api/v3/defunkt/hub', 'git.my.org'))
|
334
329
|
|
335
330
|
expected = "https://git.my.org/api/v3/defunkt/hub/pull/1\n"
|
336
|
-
assert_output expected, "pull-request hereyougo -f"
|
331
|
+
assert_output expected, "pull-request -m hereyougo -f"
|
337
332
|
end
|
338
333
|
|
339
|
-
def
|
340
|
-
|
341
|
-
|
342
|
-
to_return(:body => mock_pullreq_response(1))
|
343
|
-
|
344
|
-
expected = "https://github.com/defunkt/hub/pull/1\n"
|
345
|
-
assert_output expected, "pull-request hereyougo -h yay-feature -f"
|
346
|
-
end
|
347
|
-
|
348
|
-
def test_pullrequest_explicit_head_with_owner
|
349
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
350
|
-
with(:body => {'base' => "master", 'head' => "mojombo:feature", 'title' => "hereyougo" }).
|
351
|
-
to_return(:body => mock_pullreq_response(1))
|
352
|
-
|
353
|
-
expected = "https://github.com/defunkt/hub/pull/1\n"
|
354
|
-
assert_output expected, "pull-request hereyougo -h mojombo:feature -f"
|
355
|
-
end
|
356
|
-
|
357
|
-
def test_pullrequest_explicit_base
|
358
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
359
|
-
with(:body => {'base' => "feature", 'head' => "defunkt:master", 'title' => "hereyougo" }).
|
360
|
-
to_return(:body => mock_pullreq_response(1))
|
361
|
-
|
362
|
-
expected = "https://github.com/defunkt/hub/pull/1\n"
|
363
|
-
assert_output expected, "pull-request hereyougo -b feature -f"
|
364
|
-
end
|
365
|
-
|
366
|
-
def test_pullrequest_explicit_base_with_owner
|
367
|
-
stub_request(:post, "https://api.github.com/repos/mojombo/hub/pulls").
|
368
|
-
with(:body => {'base' => "feature", 'head' => "defunkt:master", 'title' => "hereyougo" }).
|
369
|
-
to_return(:body => mock_pullreq_response(1, 'mojombo/hub'))
|
370
|
-
|
371
|
-
expected = "https://github.com/mojombo/hub/pull/1\n"
|
372
|
-
assert_output expected, "pull-request hereyougo -b mojombo:feature -f"
|
373
|
-
end
|
374
|
-
|
375
|
-
def test_pullrequest_explicit_base_with_repo
|
376
|
-
stub_request(:post, "https://api.github.com/repos/mojombo/hubbub/pulls").
|
377
|
-
with(:body => {'base' => "feature", 'head' => "defunkt:master", 'title' => "hereyougo" }).
|
378
|
-
to_return(:body => mock_pullreq_response(1, 'mojombo/hubbub'))
|
379
|
-
|
380
|
-
expected = "https://github.com/mojombo/hubbub/pull/1\n"
|
381
|
-
assert_output expected, "pull-request hereyougo -b mojombo/hubbub:feature -f"
|
382
|
-
end
|
383
|
-
|
384
|
-
def test_pullrequest_existing_issue
|
385
|
-
stub_branch('refs/heads/myfix')
|
386
|
-
stub_tracking('myfix', 'mislav', 'awesomefix')
|
387
|
-
stub_command_output "rev-list --cherry-pick --right-only --no-merges mislav/awesomefix...", nil
|
388
|
-
|
389
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
390
|
-
with(:body => {'base' => "master", 'head' => "mislav:awesomefix", 'issue' => '92' }).
|
391
|
-
to_return(:body => mock_pullreq_response(92))
|
392
|
-
|
393
|
-
expected = "https://github.com/defunkt/hub/pull/92\n"
|
394
|
-
assert_output expected, "pull-request -i 92"
|
395
|
-
end
|
396
|
-
|
397
|
-
def test_pullrequest_existing_issue_url
|
398
|
-
stub_branch('refs/heads/myfix')
|
399
|
-
stub_tracking('myfix', 'mislav', 'awesomefix')
|
400
|
-
stub_command_output "rev-list --cherry-pick --right-only --no-merges mislav/awesomefix...", nil
|
401
|
-
|
402
|
-
stub_request(:post, "https://api.github.com/repos/mojombo/hub/pulls").
|
403
|
-
with(:body => {'base' => "master", 'head' => "mislav:awesomefix", 'issue' => '92' }).
|
404
|
-
to_return(:body => mock_pullreq_response(92, 'mojombo/hub'))
|
405
|
-
|
406
|
-
expected = "https://github.com/mojombo/hub/pull/92\n"
|
407
|
-
assert_output expected, "pull-request https://github.com/mojombo/hub/issues/92#comment_4"
|
408
|
-
end
|
409
|
-
|
410
|
-
def test_pullrequest_fails
|
411
|
-
stub_request(:post, "https://api.github.com/repos/defunkt/hub/pulls").
|
412
|
-
to_return(:status => [422, "Unprocessable Entity"],
|
413
|
-
:headers => {"Content-type" => "application/json"},
|
414
|
-
:body => %({"message":["oh no!\\nit failed."]}))
|
415
|
-
|
416
|
-
expected = "Error creating pull request: Unprocessable Entity (HTTP 422)\n"
|
417
|
-
expected << "oh no!\nit failed.\n"
|
418
|
-
assert_output expected, "pull-request hereyougo -b feature -f"
|
419
|
-
end
|
420
|
-
|
421
|
-
def test_checkout_no_changes
|
422
|
-
assert_forwarded "checkout master"
|
423
|
-
end
|
424
|
-
|
425
|
-
def test_checkout_pullrequest
|
426
|
-
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/73").
|
427
|
-
to_return(:body => mock_pull_response('blueyed:feature'))
|
428
|
-
|
429
|
-
assert_commands 'git remote add -f -t feature blueyed git://github.com/blueyed/hub.git',
|
430
|
-
'git checkout -f --track -B blueyed-feature blueyed/feature -q',
|
431
|
-
"checkout -f https://github.com/defunkt/hub/pull/73/files -q"
|
432
|
-
end
|
433
|
-
|
434
|
-
def test_checkout_private_pullrequest
|
435
|
-
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/73").
|
436
|
-
to_return(:body => mock_pull_response('blueyed:feature', :private))
|
437
|
-
|
438
|
-
assert_commands 'git remote add -f -t feature blueyed git@github.com:blueyed/hub.git',
|
439
|
-
'git checkout --track -B blueyed-feature blueyed/feature',
|
440
|
-
"checkout https://github.com/defunkt/hub/pull/73/files"
|
441
|
-
end
|
442
|
-
|
443
|
-
def test_checkout_pullrequest_custom_branch
|
444
|
-
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/73").
|
445
|
-
to_return(:body => mock_pull_response('blueyed:feature'))
|
446
|
-
|
447
|
-
assert_commands 'git remote add -f -t feature blueyed git://github.com/blueyed/hub.git',
|
448
|
-
'git checkout --track -B review blueyed/feature',
|
449
|
-
"checkout https://github.com/defunkt/hub/pull/73/files review"
|
450
|
-
end
|
451
|
-
|
452
|
-
def test_checkout_pullrequest_existing_remote
|
453
|
-
stub_command_output 'remote', "origin\nblueyed"
|
454
|
-
|
455
|
-
stub_request(:get, "https://api.github.com/repos/defunkt/hub/pulls/73").
|
456
|
-
to_return(:body => mock_pull_response('blueyed:feature'))
|
457
|
-
|
458
|
-
assert_commands 'git remote set-branches --add blueyed feature',
|
459
|
-
'git fetch blueyed +refs/heads/feature:refs/remotes/blueyed/feature',
|
460
|
-
'git checkout --track -B blueyed-feature blueyed/feature',
|
461
|
-
"checkout https://github.com/defunkt/hub/pull/73/files"
|
334
|
+
def test_pullrequest_alias
|
335
|
+
out = hub('e-note')
|
336
|
+
assert_equal hub('pull-request'), out
|
462
337
|
end
|
463
338
|
|
464
339
|
def test_version
|
@@ -495,24 +370,29 @@ class HubTest < Test::Unit::TestCase
|
|
495
370
|
end
|
496
371
|
|
497
372
|
def test_help_hub
|
498
|
-
help_manpage = hub("help hub")
|
373
|
+
help_manpage = strip_man_escapes hub("help hub")
|
499
374
|
assert_includes "git + hub = github", help_manpage
|
500
375
|
assert_includes "Hub will prompt for GitHub username & password", help_manpage.gsub(/ {2,}/, ' ')
|
501
376
|
end
|
502
377
|
|
503
378
|
def test_help_flag_on_command
|
504
|
-
help_manpage = hub("browse --help")
|
379
|
+
help_manpage = strip_man_escapes hub("browse --help")
|
505
380
|
assert_includes "git + hub = github", help_manpage
|
506
381
|
assert_includes "git browse", help_manpage
|
507
382
|
end
|
508
383
|
|
384
|
+
def test_help_custom_command
|
385
|
+
help_manpage = strip_man_escapes hub("help fork")
|
386
|
+
assert_includes "git fork [--no-remote]", help_manpage
|
387
|
+
end
|
388
|
+
|
509
389
|
def test_help_short_flag_on_command
|
510
390
|
usage_help = hub("create -h")
|
511
391
|
expected = "Usage: git create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]\n"
|
512
392
|
assert_equal expected, usage_help
|
513
393
|
|
514
394
|
usage_help = hub("pull-request -h")
|
515
|
-
expected = "Usage: git pull-request [-f] [
|
395
|
+
expected = "Usage: git pull-request [-f] [-m MESSAGE|-F FILE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]\n"
|
516
396
|
assert_equal expected, usage_help
|
517
397
|
end
|
518
398
|
|
@@ -612,6 +492,10 @@ class HubTest < Test::Unit::TestCase
|
|
612
492
|
stub_tracking(from, nil)
|
613
493
|
end
|
614
494
|
|
495
|
+
def stub_remote_branch(branch, sha = 'abc123')
|
496
|
+
stub_command_output "rev-parse -q --verify refs/remotes/#{branch}", sha
|
497
|
+
end
|
498
|
+
|
615
499
|
def stub_remotes_group(name, value)
|
616
500
|
stub_config_value "remotes.#{name}", value
|
617
501
|
end
|
@@ -716,4 +600,8 @@ class HubTest < Test::Unit::TestCase
|
|
716
600
|
end
|
717
601
|
end
|
718
602
|
|
603
|
+
def strip_man_escapes(manpage)
|
604
|
+
manpage.gsub(/_\010/, '').gsub(/\010./, '')
|
605
|
+
end
|
606
|
+
|
719
607
|
end
|
data/test/standalone_test.rb
CHANGED
@@ -3,7 +3,7 @@ require 'hub/standalone'
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'stringio'
|
5
5
|
|
6
|
-
class StandaloneTest < Test
|
6
|
+
class StandaloneTest < Minitest::Test
|
7
7
|
include FileUtils
|
8
8
|
|
9
9
|
def setup
|
@@ -36,7 +36,11 @@ class StandaloneTest < Test::Unit::TestCase
|
|
36
36
|
|
37
37
|
def test_standalone_save
|
38
38
|
Hub::Standalone.save("hub")
|
39
|
-
|
39
|
+
output = `RUBYOPT= RUBYLIB= ./hub version 2>&1`
|
40
|
+
assert_equal <<-OUT, output
|
41
|
+
git version 1.7.0.4
|
42
|
+
hub version #{Hub::VERSION}
|
43
|
+
OUT
|
40
44
|
end
|
41
45
|
|
42
46
|
def test_standalone_save_permission_denied
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.11.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Chris Wanstrath
|
@@ -10,40 +10,40 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
prerelease: false
|
17
|
-
type: :development
|
18
16
|
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
17
|
requirements:
|
21
18
|
- - ! '>='
|
22
19
|
- !ruby/object:Gem::Version
|
23
20
|
version: '0'
|
21
|
+
none: false
|
24
22
|
name: rake
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
25
|
requirement: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
26
|
requirements:
|
28
27
|
- - ! '>='
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: '0'
|
30
|
+
none: false
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
prerelease: false
|
33
|
-
type: :development
|
34
32
|
version_requirements: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
33
|
requirements:
|
37
34
|
- - ! '>='
|
38
35
|
- !ruby/object:Gem::Version
|
39
36
|
version: '0'
|
37
|
+
none: false
|
40
38
|
name: webmock
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
41
|
requirement: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
42
|
requirements:
|
44
43
|
- - ! '>='
|
45
44
|
- !ruby/object:Gem::Version
|
46
45
|
version: '0'
|
46
|
+
none: false
|
47
47
|
description: ! " `hub` is a command line utility which adds GitHub knowledge to `git`.\n\n
|
48
48
|
\ It can used on its own or as a `git` wrapper.\n\n Normal:\n\n $ hub clone
|
49
49
|
rtomayko/tilt\n\n Expands to:\n $ git clone git://github.com/rtomayko/tilt.git\n\n
|
@@ -58,51 +58,58 @@ files:
|
|
58
58
|
- README.md
|
59
59
|
- Rakefile
|
60
60
|
- LICENSE
|
61
|
-
- HISTORY.md
|
62
61
|
- lib/hub/args.rb
|
63
62
|
- lib/hub/commands.rb
|
64
63
|
- lib/hub/context.rb
|
65
64
|
- lib/hub/github_api.rb
|
66
65
|
- lib/hub/json.rb
|
67
66
|
- lib/hub/runner.rb
|
67
|
+
- lib/hub/speedy_stdlib.rb
|
68
68
|
- lib/hub/ssh_config.rb
|
69
69
|
- lib/hub/standalone.rb
|
70
70
|
- lib/hub/version.rb
|
71
71
|
- lib/hub.rb
|
72
|
+
- bin/bench
|
72
73
|
- bin/hub
|
73
74
|
- man/hub.1
|
74
75
|
- man/hub.1.html
|
75
76
|
- man/hub.1.ronn
|
77
|
+
- script/cached-bundle
|
78
|
+
- script/s3-put
|
79
|
+
- script/test
|
80
|
+
- script/test_each
|
81
|
+
- test/context_test.rb
|
76
82
|
- test/deps.rip
|
77
83
|
- test/fakebin/git
|
78
84
|
- test/fakebin/open
|
85
|
+
- test/github_api_test.rb
|
79
86
|
- test/helper.rb
|
80
87
|
- test/hub_test.rb
|
81
88
|
- test/standalone_test.rb
|
82
|
-
homepage: http://
|
89
|
+
homepage: http://hub.github.com/
|
83
90
|
licenses:
|
84
91
|
- MIT
|
85
92
|
post_install_message: ! "\n------------------------------------------------------------\n\n
|
86
93
|
\ You there! Wait, I say!\n =======================\n\n
|
87
94
|
\ If you are a heavy user of `git` on the command\n line you may want
|
88
95
|
\ to install `hub` the old\n fashioned way. Faster startup time, you
|
89
|
-
see.\n\n Check out the installation instructions at\n https://github.com/
|
96
|
+
see.\n\n Check out the installation instructions at\n https://github.com/github/hub#readme
|
90
97
|
\ under the\n \"Standalone\" section.\n\n Cheers,\n defunkt\n\n------------------------------------------------------------\n\n"
|
91
98
|
rdoc_options: []
|
92
99
|
require_paths:
|
93
100
|
- lib
|
94
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
102
|
requirements:
|
97
103
|
- - ! '>='
|
98
104
|
- !ruby/object:Gem::Version
|
99
105
|
version: '0'
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
106
|
none: false
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
108
|
requirements:
|
103
109
|
- - ! '>='
|
104
110
|
- !ruby/object:Gem::Version
|
105
111
|
version: '0'
|
112
|
+
none: false
|
106
113
|
requirements: []
|
107
114
|
rubyforge_project:
|
108
115
|
rubygems_version: 1.8.23
|