Adds api-ref, docs, or installdocs statistics measures

Use --apiref or --docs or --installdocs as arguments to view docs stats.

Ideally this report can be run to see which projects are doing
the most docs and api-ref changes and reviews. Would be helpful
to see which projects need docs contributors, which projects
need docs reviewers, which projects have healthy docs.

Change-Id: Ifce720a3c796d4f0a7d3dc6383f9dfb4384f7220
This commit is contained in:
Anne Gentle 2017-04-30 08:47:53 -05:00 committed by Andreas Jaeger
parent 548a85d2a9
commit 7c70f45f03
5 changed files with 60 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
.lpcreds
results
*.py[cod]
.DS_Store
# C extensions
*.so

View File

@ -2,7 +2,7 @@
reviewstats
===========
Utility scripts for generating stats about OpenStack development.
Utility scripts for generating stats about OpenStack development and docs.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/reviewstats

View File

@ -265,6 +265,15 @@ def main(argv=None):
optparser.add_option(
'--server', default='review.openstack.org',
help='Gerrit server to connect to')
optparser.add_option(
'--apiref', action='store_true',
help='Show specific stats for <project>/api-ref/source in reports')
optparser.add_option(
'--docs', action='store_true',
help='Show specific stats for <project>/doc/source in reports')
optparser.add_option(
'--installdocs', action='store_true',
help='Show specific stats for <project>/install in reports')
optparser.add_option(
'--debug', action='store_true', help='Show extra debug output')
optparser.add_option(
@ -327,6 +336,21 @@ def main(argv=None):
if waiting_for_review:
waiting_on_reviewer.append(change)
if options.apiref:
utils.get_changes(projects, options.user, options.key,
only_open=True, server=options.server,
limit_to_path='api-ref/source')
print 'API reference changes waiting on review'
if options.docs:
utils.get_changes(projects, options.user, options.key,
only_open=True, server=options.server,
limit_to_path='doc/source')
print 'Docs changes waiting on review'
if options.installdocs:
utils.get_changes(projects, options.user, options.key,
only_open=True, server=options.server,
limit_to_path='install-guide/source')
print 'Docs changes waiting on review'
else:
waiting_on_submitter.append(change)

View File

@ -269,6 +269,15 @@ def main(argv=None):
optparser.add_option(
'--server', default='review.openstack.org',
help='Gerrit server to connect to')
optparser.add_option(
'--apiref', action='store_true',
help='Generate specific stats for <project>/api-ref/source in reports')
optparser.add_option(
'--docs', action='store_true',
help='Generate specific stats for <project>/doc/source in reports')
optparser.add_option(
'--installdocs', action='store_true',
help='Generate specific stats for <project>/install/source in reports')
options, args = optparser.parse_args()
@ -297,10 +306,24 @@ def main(argv=None):
'wip': 0,
}
limit_to_path = ''
if options.apiref:
limit_to_path = 'api-ref/source'
print('API reference reviewers compilation')
if options.docs:
limit_to_path = 'doc/source'
print('Docs reviewers compilation')
if options.installdocs:
limit_to_path = 'install'
print('Install doc reviewers compilation')
for project in projects:
changes = utils.get_changes([project], options.user, options.key,
stable=options.stable,
server=options.server)
server=options.server,
limit_to_path=limit_to_path)
for change in changes:
patch_for_change = False
first_patchset = True

View File

@ -21,6 +21,7 @@ import glob
import json
import logging
import os
import re
import requests
import requests.auth
from six.moves import cPickle as pickle
@ -101,7 +102,7 @@ def projects_q(project):
def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
server='review.openstack.org'):
limit_to_path=None, server='review.openstack.org'):
"""Get the changesets data list.
:param projects: List of gerrit project names.
@ -190,6 +191,14 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
cmd += ' status:open'
if stable:
cmd += ' branch:stable/%s' % stable
if limit_to_path:
# Get patchsets for project docs in doc/source
# Patchsets for API reference docs are in api-ref/source
# Patchsets for install guides are in a path containing
# install-guide/source
cmd += ' file:^.*%s.*' % re.escape(limit_to_path)
# XXX: For debugging
print(cmd)
if new_count:
cmd += ' --start %d' % new_count
else: