git-review 0.7.9 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/git-review.rb +42 -39
- metadata +5 -5
data/lib/git-review.rb
CHANGED
@@ -18,9 +18,9 @@ class GitReview
|
|
18
18
|
next if merged?(pending_request['head']['sha'])
|
19
19
|
line = format_text(pending_request['number'], 8)
|
20
20
|
date_string = format_time(pending_request['updated_at'])
|
21
|
-
line
|
22
|
-
line
|
23
|
-
line
|
21
|
+
line << format_text(date_string, 11)
|
22
|
+
line << format_text(pending_request['comments'], 10)
|
23
|
+
line << format_text(pending_request['title'], 91)
|
24
24
|
line
|
25
25
|
end
|
26
26
|
if output.compact.empty?
|
@@ -37,47 +37,20 @@ class GitReview
|
|
37
37
|
return unless request_exists?
|
38
38
|
option = @args.shift == '--full' ? '' : '--stat '
|
39
39
|
sha = @pending_request['head']['sha']
|
40
|
-
puts "ID
|
41
|
-
puts "Label
|
42
|
-
puts "Updated
|
43
|
-
puts "Comments
|
40
|
+
puts "ID : #{@pending_request['number']}"
|
41
|
+
puts "Label : #{@pending_request['head']['label']}"
|
42
|
+
puts "Updated : #{format_time(@pending_request['updated_at'])}"
|
43
|
+
puts "Comments : #{@pending_request['comments']}"
|
44
44
|
puts
|
45
45
|
puts @pending_request['title']
|
46
46
|
puts
|
47
47
|
puts @pending_request['body']
|
48
48
|
puts
|
49
49
|
puts git_call("diff --color=always #{option}HEAD...#{sha}")
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return unless request_exists?
|
55
|
-
request = Octokit.pull_request(source_repo, @pending_request['number'])
|
56
|
-
discussion = request['discussion'][1..-1]
|
57
|
-
result = discussion.collect do |entry|
|
58
|
-
# For now we only show comments and commits.
|
59
|
-
if ["IssueComment", "Commit"].include?(entry['type'])
|
60
|
-
output = "'#{entry["user"]["login"]}' "
|
61
|
-
case entry['type']
|
62
|
-
# Comments:
|
63
|
-
when "IssueComment"
|
64
|
-
output << "added a comment on #{format_time(entry['created_at'])}"
|
65
|
-
unless entry['created_at'] == entry['updated_at']
|
66
|
-
output << " (updated on #{format_time(entry['updated_at'])})"
|
67
|
-
end
|
68
|
-
output << ":\n#{''.rjust(output.length + 1, "-")}\n#{entry["body"]}"
|
69
|
-
# Commits:
|
70
|
-
when "Commit"
|
71
|
-
output << "authored a commit on #{format_time(entry['authored_date'])}"
|
72
|
-
unless entry['authored_date'] == entry['committed_date']
|
73
|
-
output << " (committed on #{format_time(entry['committed_date'])})"
|
74
|
-
end
|
75
|
-
output << ":\n#{''.rjust(output.length + 1, "-")}\n#{entry["message"]}"
|
76
|
-
end
|
77
|
-
output << "\n\n"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
puts result.compact unless result.empty?
|
50
|
+
puts
|
51
|
+
puts "Progress :"
|
52
|
+
puts
|
53
|
+
discussion
|
81
54
|
end
|
82
55
|
|
83
56
|
# Open a browser window and review a specified request.
|
@@ -182,6 +155,7 @@ class GitReview
|
|
182
155
|
# Start a console session (used for debugging).
|
183
156
|
def console
|
184
157
|
puts 'Entering debug console.'
|
158
|
+
request_exists?
|
185
159
|
require 'ruby-debug'
|
186
160
|
Debugger.start
|
187
161
|
debugger
|
@@ -217,7 +191,6 @@ class GitReview
|
|
217
191
|
puts 'Available commands:'
|
218
192
|
puts ' list [--reverse] List all pending requests.'
|
219
193
|
puts ' show <ID> [--full] Show details for a single request.'
|
220
|
-
puts ' discussion <number> Shows ongoing discussions for a single request.'
|
221
194
|
puts ' browse <ID> Open a browser window and review a specified request.'
|
222
195
|
puts ' checkout <ID> [--branch] Checkout a specified request\'s changes to your local repository.'
|
223
196
|
puts ' merge <ID> Accept a specified request by merging it into master.'
|
@@ -271,6 +244,36 @@ class GitReview
|
|
271
244
|
output
|
272
245
|
end
|
273
246
|
|
247
|
+
# Show current discussion for @pending_request.
|
248
|
+
def discussion
|
249
|
+
request = Octokit.pull_request(source_repo, @pending_request['number'])
|
250
|
+
result = request['discussion'].collect do |entry|
|
251
|
+
output = "\e[35m#{entry["user"]["login"]}\e[m "
|
252
|
+
case entry['type']
|
253
|
+
# Comments:
|
254
|
+
when "IssueComment", "CommitComment", "PullRequestReviewComment"
|
255
|
+
output << "added a comment"
|
256
|
+
output << " to \e[36m#{entry['commit_id'][0..6]}\e[m" if entry['commit_id']
|
257
|
+
output << " on #{format_time(entry['created_at'])}"
|
258
|
+
unless entry['created_at'] == entry['updated_at']
|
259
|
+
output << " (updated on #{format_time(entry['updated_at'])})"
|
260
|
+
end
|
261
|
+
output << ":\n#{''.rjust(output.length + 1, "-")}\n"
|
262
|
+
output << "> \e[32m#{entry['path']}:#{entry['position']}\e[m\n" if entry['path'] and entry['position']
|
263
|
+
output << entry['body']
|
264
|
+
# Commits:
|
265
|
+
when "Commit"
|
266
|
+
output << "authored commit \e[36m#{entry['id'][0..6]}\e[m on #{format_time(entry['authored_date'])}"
|
267
|
+
unless entry['authored_date'] == entry['committed_date']
|
268
|
+
output << " (committed on #{format_time(entry['committed_date'])})"
|
269
|
+
end
|
270
|
+
output << ":\n#{''.rjust(output.length + 1, "-")}\n#{entry["message"]}"
|
271
|
+
end
|
272
|
+
output << "\n\n\n"
|
273
|
+
end
|
274
|
+
puts result.compact unless result.empty?
|
275
|
+
end
|
276
|
+
|
274
277
|
# Display helper to make output more configurable.
|
275
278
|
def format_text(info, size)
|
276
279
|
info.to_s.gsub("\n", ' ')[0, size-1].ljust(size)
|
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: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dominik Bamberger, Cristian Messel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-19 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|