git-review 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git-review.rb +26 -26
- metadata +6 -8
data/lib/git-review.rb
CHANGED
@@ -136,20 +136,26 @@ class GitReview
|
|
136
136
|
def create
|
137
137
|
# Prepare @local_branch.
|
138
138
|
prepare
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
139
|
+
unless git_call("cherry #{target_branch}").empty?
|
140
|
+
# Push latest commits to the remote branch (and by that, create it if necessary).
|
141
|
+
git_call "push --set-upstream origin #{@local_branch}"
|
142
|
+
# Gather information.
|
143
|
+
last_request_id = @pending_requests.collect{|req| req['number'] }.sort.last.to_i
|
144
|
+
title = "[Review] Request from '#{git_config['github.login']}' @ '#{source}'"
|
145
|
+
# TODO: Insert commit messages (that are not yet in master) into body (since this will be displayed inside the mail that is sent out).
|
146
|
+
body = 'Please review the following changes:'
|
147
|
+
# Create the actual pull request.
|
148
|
+
Octokit.create_pull_request(target_repo, target_branch, source_branch, title, body)
|
149
|
+
# Switch back to target_branch and check for success.
|
150
|
+
git_call "checkout #{target_branch}"
|
151
|
+
update
|
152
|
+
potential_new_request = @pending_requests.find{ |req| req['title'] == title }
|
153
|
+
if potential_new_request and potential_new_request['number'] > last_request_id
|
154
|
+
puts 'Successfully created new request.'
|
155
|
+
end
|
156
|
+
else
|
157
|
+
"Nothing to push to remote yet. Commit something first."
|
158
|
+
end
|
153
159
|
end
|
154
160
|
|
155
161
|
# Start a console session (used for debugging).
|
@@ -226,9 +232,8 @@ class GitReview
|
|
226
232
|
repo = req['head']['repository']
|
227
233
|
"#{repo['owner']}/#{repo['name']}" unless repo.nil?
|
228
234
|
end
|
229
|
-
host = URI.parse(github_endpoint).host
|
230
235
|
repos.uniq.compact.each do |repo|
|
231
|
-
git_call("fetch git
|
236
|
+
git_call("fetch git@github.com:#{repo}.git +refs/heads/*:refs/pr/#{repo}/*")
|
232
237
|
end
|
233
238
|
end
|
234
239
|
|
@@ -323,28 +328,23 @@ class GitReview
|
|
323
328
|
|
324
329
|
# Uses Octokit to access GitHub.
|
325
330
|
def configure_github_access
|
326
|
-
if git_config['github.login'] and git_config['github.
|
331
|
+
if git_config['github.login'] and git_config['github.password']
|
327
332
|
Octokit.configure do |config|
|
333
|
+
config.api_version = 2
|
328
334
|
config.login = git_config['github.login']
|
329
|
-
config.
|
330
|
-
config.endpoint = github_endpoint
|
335
|
+
config.password = git_config['github.password']
|
331
336
|
end
|
332
337
|
true
|
333
338
|
else
|
334
|
-
puts 'Please update your git config and provide your GitHub login and
|
339
|
+
puts 'Please update your git config and provide your GitHub login and password.'
|
335
340
|
puts
|
336
341
|
puts ' git config --global github.login your_github_login_1234567890'
|
337
|
-
puts ' git config --global github.
|
342
|
+
puts ' git config --global github.password your_github_password_1234567890'
|
338
343
|
puts
|
339
344
|
false
|
340
345
|
end
|
341
346
|
end
|
342
347
|
|
343
|
-
# Determine GitHub endpoint (defaults to 'https://github.com/').
|
344
|
-
def github_endpoint
|
345
|
-
git_config['github.endpoint'] || 'https://github.com/'
|
346
|
-
end
|
347
|
-
|
348
348
|
def debug_mode
|
349
349
|
git_config['review.mode'] == 'debug'
|
350
350
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-review
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 4
|
10
|
+
version: 0.8.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dominik Bamberger, Cristian Messel
|
@@ -38,14 +38,12 @@ dependencies:
|
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 3
|
44
44
|
segments:
|
45
45
|
- 0
|
46
|
-
|
47
|
-
- 1
|
48
|
-
version: 0.5.1
|
46
|
+
version: "0"
|
49
47
|
type: :runtime
|
50
48
|
version_requirements: *id002
|
51
49
|
- !ruby/object:Gem::Dependency
|