add watched queries to list-changes
Add a data file for defining gerrit queries so we can track incomplete work for known initiatives when reviewing releases. Include a query for patches owned by the proposal bot (to watch for requirements updates and other automated changes) and another to watch for documentation file updates (to let us monitor the doc migration initiative for pike). Change-Id: I12c59d83267bf80773876e81b3470bfe3062ad27 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
0f99cce285
commit
ca9884b44e
@ -20,6 +20,7 @@ from __future__ import print_function
|
||||
import argparse
|
||||
import atexit
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
@ -27,6 +28,8 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import requests
|
||||
|
||||
from openstack_releases import defaults
|
||||
from openstack_releases import gitutils
|
||||
from openstack_releases import governance
|
||||
@ -106,6 +109,41 @@ def git_diff(workdir, repo, git_range, file_pattern):
|
||||
print()
|
||||
|
||||
|
||||
def gerrit_query(*query):
|
||||
url = 'https://review.openstack.org/changes/?q=' + '+'.join(query)
|
||||
response = requests.get(url)
|
||||
if response.content[:4] == b")]}'":
|
||||
content = response.content[5:].decode('utf-8')
|
||||
return json.loads(content)
|
||||
else:
|
||||
print('could not parse response from %s' % url)
|
||||
print(repr(content))
|
||||
raise RuntimeError('failed to parse gerrit response')
|
||||
|
||||
|
||||
def list_gerrit_patches(title, template, query):
|
||||
header('{}: "{}"'.format(title, query))
|
||||
reviews = gerrit_query(query)
|
||||
for r in reviews:
|
||||
print(template.format(**r))
|
||||
print('{} results\n'.format(len(reviews)))
|
||||
|
||||
|
||||
def show_watched_queries(branch, repo):
|
||||
with open('watched_queries.yml', 'r', encoding='utf-8') as f:
|
||||
watched_queries = yamlutils.loads(f.read())
|
||||
template = watched_queries['template']
|
||||
for q in watched_queries['queries']:
|
||||
list_gerrit_patches(
|
||||
q['title'],
|
||||
q.get('template', template),
|
||||
q['query'].format(
|
||||
branch=branch,
|
||||
project=repo,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
if not sys.stdout.encoding:
|
||||
# Wrap sys.stdout with a writer that knows how to handle
|
||||
@ -342,6 +380,8 @@ def main():
|
||||
'%s..%s' % (requested_sha, head_sha),
|
||||
extra_args=['--format=%h %ci %s'])
|
||||
|
||||
show_watched_queries(branch, project['repo'])
|
||||
|
||||
# Show any requirements changes in the upcoming release.
|
||||
# Include setup.cfg, in case the project uses "extras".
|
||||
if start_range:
|
||||
|
36
watched_queries.yml
Normal file
36
watched_queries.yml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
# The template string shows how to format the info for each review.
|
||||
# A review contains:
|
||||
# {'_number': 490743,
|
||||
# 'mergeable': True,
|
||||
# 'subject': 'Updated from global requirements',
|
||||
# 'project': 'openstack/congress',
|
||||
# 'owner': {'_account_id': 11131},
|
||||
# 'branch': 'master',
|
||||
# 'insertions': 1,
|
||||
# 'created': '2017-08-04 04:31:47.000000000',
|
||||
# 'deletions': 1,
|
||||
# 'id': 'openstack%2Fcongress~master~I52e06d42a25e1780984fbf37fe9cd2c7e4bc8a9f',
|
||||
# 'hashtags': [],
|
||||
# 'topic': 'openstack/requirements',
|
||||
# 'status': 'NEW',
|
||||
# 'updated': '2017-08-04 11:12:50.000000000',
|
||||
# 'change_id': 'I52e06d42a25e1780984fbf37fe9cd2c7e4bc8a9f'}
|
||||
|
||||
template: |
|
||||
[{status}] {subject}
|
||||
Updated: {updated}
|
||||
Topic: {topic}
|
||||
https://review.openstack.org/{_number}
|
||||
|
||||
|
||||
# The query items need a title, to be displayed above the output, and
|
||||
# a query string. The query string can include {branch} and {project},
|
||||
# which will be replaced with the full branch name and the git
|
||||
# repository name respectively.
|
||||
|
||||
queries:
|
||||
- title: Open patches from the proposal bot
|
||||
query: "is:open branch:{branch} project:{project} owner:proposal-bot"
|
||||
- title: Documentation patches
|
||||
query: "is:open branch:{branch} project:{project} path:^doc/source/.*"
|
Loading…
Reference in New Issue
Block a user