Added some optinos to openreviews
* --debug, to set the logging level to debug * --server, to specify a custom server * --projects-dir, to specify a custom directory to fetch the projects from * Adapted to the review statuses for gerrit 2.6.1 Change-Id: Id06f0cde90c675210fb0e19ed8bda98e8e76beca Signed-off-by: David Caro <dcaroest@redhat.com>
This commit is contained in:
parent
3f7dbba420
commit
7997b0be97
@ -21,6 +21,7 @@ import datetime
|
|||||||
import getpass
|
import getpass
|
||||||
import optparse
|
import optparse
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
@ -94,8 +95,8 @@ def gen_stats(projects, waiting_on_reviewer, waiting_on_submitter, options):
|
|||||||
result.append(('Projects', '%s' % [project['name']
|
result.append(('Projects', '%s' % [project['name']
|
||||||
for project in projects]))
|
for project in projects]))
|
||||||
stats = []
|
stats = []
|
||||||
stats.append(('Total Open Reviews', '%d' % (
|
stats.append(('Total Open Reviews', '%d'
|
||||||
len(waiting_on_reviewer) + len(waiting_on_submitter))))
|
% (len(waiting_on_reviewer) + len(waiting_on_submitter))))
|
||||||
stats.append(('Waiting on Submitter', '%d' % len(waiting_on_submitter)))
|
stats.append(('Waiting on Submitter', '%d' % len(waiting_on_submitter)))
|
||||||
stats.append(('Waiting on Reviewer', '%d' % len(waiting_on_reviewer)))
|
stats.append(('Waiting on Reviewer', '%d' % len(waiting_on_reviewer)))
|
||||||
|
|
||||||
@ -216,7 +217,7 @@ def find_oldest_no_nack(change):
|
|||||||
for patch in reversed(change['patchSets']):
|
for patch in reversed(change['patchSets']):
|
||||||
nacked = False
|
nacked = False
|
||||||
for review in patch.get('approvals', []):
|
for review in patch.get('approvals', []):
|
||||||
if review['type'] != 'CRVW':
|
if review['type'] != 'CRVW' and review['type'] != 'Code-Review':
|
||||||
continue
|
continue
|
||||||
if review['value'] in ('-1', '-2'):
|
if review['value'] in ('-1', '-2'):
|
||||||
nacked = True
|
nacked = True
|
||||||
@ -254,17 +255,30 @@ def main(argv=None):
|
|||||||
optparser.add_option(
|
optparser.add_option(
|
||||||
'-H', '--html', action='store_true',
|
'-H', '--html', action='store_true',
|
||||||
help='Use HTML output instead of plain text')
|
help='Use HTML output instead of plain text')
|
||||||
|
optparser.add_option(
|
||||||
|
'--server', default='review.openstack.org',
|
||||||
|
help='Gerrit server to connect to')
|
||||||
|
optparser.add_option(
|
||||||
|
'--debug', action='store_true', help='Show extra debug output')
|
||||||
|
optparser.add_option(
|
||||||
|
'--projects-dir', default='./projects',
|
||||||
|
help='Directory where to locate the project files')
|
||||||
|
|
||||||
options, args = optparser.parse_args()
|
options, args = optparser.parse_args()
|
||||||
|
|
||||||
projects = utils.get_projects_info(options.project, options.all)
|
logging.basicConfig(level=logging.ERROR)
|
||||||
|
if options.debug:
|
||||||
|
logging.root.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
projects = utils.get_projects_info(options.project, options.all,
|
||||||
|
base_dir=options.projects_dir)
|
||||||
|
|
||||||
if not projects:
|
if not projects:
|
||||||
print "Please specify a project."
|
print "Please specify a project."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
changes = utils.get_changes(projects, options.user, options.key,
|
changes = utils.get_changes(projects, options.user, options.key,
|
||||||
only_open=True)
|
only_open=True, server=options.server)
|
||||||
|
|
||||||
waiting_on_submitter = []
|
waiting_on_submitter = []
|
||||||
waiting_on_reviewer = []
|
waiting_on_reviewer = []
|
||||||
@ -285,7 +299,8 @@ def main(argv=None):
|
|||||||
approvals = latest_patch.get('approvals', [])
|
approvals = latest_patch.get('approvals', [])
|
||||||
approvals.sort(key=lambda a: a['grantedOn'])
|
approvals.sort(key=lambda a: a['grantedOn'])
|
||||||
for review in approvals:
|
for review in approvals:
|
||||||
if review['type'] not in ('CRVW', 'VRIF'):
|
if review['type'] not in ('CRVW', 'VRIF',
|
||||||
|
'Code-Review', 'Verified'):
|
||||||
continue
|
continue
|
||||||
if review['value'] in ('-1', '-2'):
|
if review['value'] in ('-1', '-2'):
|
||||||
waiting_for_review = False
|
waiting_for_review = False
|
||||||
|
Loading…
Reference in New Issue
Block a user