git_pr 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/git-pr +3 -3
- data/lib/git_pr/git.rb +24 -0
- data/lib/git_pr/github.rb +5 -5
- data/lib/git_pr/version.rb +1 -1
- data/lib/git_pr.rb +1 -0
- metadata +23 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 011c22bbbb24143c1bab09ee5d53aff9446fd4ac
|
4
|
+
data.tar.gz: 3ff6bef6c765bed54291f933d6a47a664b302eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d4b63380be765e9e2201ff436bdf34c9779fb5eda138902a4f1641ce17bdeccfeaf85f096a4e968b77c8e1cbfb051d58bb14fe0f99eaf14d7c93b33e9277ba
|
7
|
+
data.tar.gz: 4fd93b31cc3fe78d3b93b2ac9e7f5f20a279a6610194faaec6f4c47f6e9a8fed04d8a51e24d9288296782bcaf19812bdb3884e3c778001324b9c98f850271206
|
data/bin/git-pr
CHANGED
@@ -234,7 +234,7 @@ when "open"
|
|
234
234
|
# We didn't find a matching pull request, so let's try to open the "create
|
235
235
|
# pull request" page.
|
236
236
|
source = source
|
237
|
-
if not git.
|
237
|
+
if not git.is_local_branch_fast? source
|
238
238
|
puts "Unknown branch '#{source}'.".red
|
239
239
|
exit -1
|
240
240
|
end
|
@@ -250,8 +250,8 @@ when "open"
|
|
250
250
|
# https://github.com/FiftyThree/Studio/compare/FiftyThree:master...floatplane:blobstore
|
251
251
|
# So I need to: get the upstream for the named branch. Extract the github project owner.
|
252
252
|
github_target_owner, github_target_project = github_project.split "/"
|
253
|
-
|
254
|
-
remote_url =
|
253
|
+
remote = git.find_remote_for_local_branch source
|
254
|
+
remote_url = remote ? remote.url : nil
|
255
255
|
unless remote_url and remote_url.match /github\.com/
|
256
256
|
puts "Branch '#{source}' has never been pushed to GitHub."
|
257
257
|
exit -1
|
data/lib/git_pr/git.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'git'
|
2
|
+
|
3
|
+
# Add some methods to the git class that operate a lot faster than the defaults
|
4
|
+
class Git::Base
|
5
|
+
|
6
|
+
# Default implementation of is_local_branch? will create O(N) Git::Branch
|
7
|
+
# objects for all branches, local *and* remote. All we care about is
|
8
|
+
# existence, so we don't need all that.
|
9
|
+
def is_local_branch_fast?(branch)
|
10
|
+
self.chdir do
|
11
|
+
local_branches = `git branch`.split.map { |b| b.gsub('*', '').strip }
|
12
|
+
local_branches.include? branch
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Shortcut to create a remote for a particular branch, if the branch has an upstream.
|
17
|
+
def find_remote_for_local_branch(branch)
|
18
|
+
self.chdir do
|
19
|
+
remote_name = `git for-each-ref --format='%(upstream:short)' refs/heads/#{branch}`.strip.sub(/\/#{branch}$/, '')
|
20
|
+
remote_name.empty? ? nil : Git::Remote.new(self, remote_name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/git_pr/github.rb
CHANGED
@@ -43,11 +43,11 @@ module GitPr
|
|
43
43
|
|
44
44
|
client = Octokit::Client.new :login => user, :password => pass
|
45
45
|
begin
|
46
|
-
|
47
|
-
auth =
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
hostname = `hostname`.strip!
|
47
|
+
auth = client.create_authorization(:scopes => ["user", "repo"],
|
48
|
+
:note => "#{AUTH_KEY_NAME} (#{hostname})",
|
49
|
+
:fingerprint => "#{hostname} #{Time.now}",
|
50
|
+
:headers => headers)
|
51
51
|
rescue Octokit::Unauthorized
|
52
52
|
puts "Invalid username or password."
|
53
53
|
return false
|
data/lib/git_pr/version.rb
CHANGED
data/lib/git_pr.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_pr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Sharon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: git
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: netrc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: octokit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.6'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.6'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: ''
|
@@ -130,7 +130,7 @@ executables:
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
-
- .gitignore
|
133
|
+
- ".gitignore"
|
134
134
|
- Gemfile
|
135
135
|
- LICENSE.txt
|
136
136
|
- README.md
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- git_pr.gemspec
|
140
140
|
- lib/git_pr.rb
|
141
141
|
- lib/git_pr/diff.rb
|
142
|
+
- lib/git_pr/git.rb
|
142
143
|
- lib/git_pr/github.rb
|
143
144
|
- lib/git_pr/merge.rb
|
144
145
|
- lib/git_pr/pull_request.rb
|
@@ -153,17 +154,17 @@ require_paths:
|
|
153
154
|
- lib
|
154
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
156
|
requirements:
|
156
|
-
- -
|
157
|
+
- - ">="
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
161
|
requirements:
|
161
|
-
- -
|
162
|
+
- - ">="
|
162
163
|
- !ruby/object:Gem::Version
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.4.8
|
167
168
|
signing_key:
|
168
169
|
specification_version: 4
|
169
170
|
summary: A tool for listing and merging GitHub pull requests.
|