Created
September 24, 2014 04:16
-
-
Save anonymous/a6b10d78e32fc32ccb5d to your computer and use it in GitHub Desktop.
List what patches you have to review in gerrit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/ssh' | |
require 'json' | |
users = %w(user) | |
host = localhost | |
Net::SSH.start(host, ENV['USER'] , port: 29418) do |ssh| | |
result = ssh.exec!('gerrit ls-projects --type code --format json') | |
data = JSON.parse(result) | |
projects = data.keys | |
projects.each do |project| | |
puts "For the #{project} project" | |
users.each do |user| | |
result = ssh.exec!("gerrit query --format=JSON -- -owner:#{user} status:open -reviewer:#{user} project:#{project} -is:draft") | |
data = JSON.parse("[#{result.lines.to_a.join(',')}]") | |
count = data[-1]['rowCount'] | |
puts " #{user} has #{count} patchs to review" if count > 0 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment