From e7a910eb6cbf6ec547a00a70a16e715392094de4 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 17 Aug 2011 10:14:09 -0700 Subject: [PATCH] Update blueprint script to add topic links. If a gerrit topic is provided and indicates a blueprint, update the blueprint with a link to the gerrit search for that topic. Change-Id: I94a15b0eb47dddd0aa27b91d62b14bcb78f79537 Reviewed-on: https://review.openstack.org/262 Reviewed-by: Monty Taylor Tested-by: Jenkins --- gerrit/update_blueprint.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gerrit/update_blueprint.py b/gerrit/update_blueprint.py index 1a7e6bfb..2dba6bd6 100755 --- a/gerrit/update_blueprint.py +++ b/gerrit/update_blueprint.py @@ -58,7 +58,7 @@ DB_USER = GERRIT_CONFIG.get("database", "username") DB_PASS = SECURE_CONFIG.get("database","password") DB_DB = GERRIT_CONFIG.get("database","database") -def update_spec(launchpad, project, name, subject, link): +def update_spec(launchpad, project, name, subject, link, topic=False): # For testing, if a project doesn't match openstack/foo, use # the openstack-ci project instead. group, project = project.split('/') @@ -69,9 +69,20 @@ def update_spec(launchpad, project, name, subject, link): if not spec: return wb = spec.whiteboard.strip() + changed = False + if topic: + topiclink = '%s/#q,topic:%s,n,z' % (link[:link.find('/',8)], + name) + if topiclink not in wb: + wb += "\n\n\nGerrit topic: %(link)s" % dict(link=topiclink) + changed = True + if link not in wb: - wb += "\n\n\nAddressed by %(link)s\n %(subject)s\n" % dict(subject=subject, + wb += "\n\n\nAddressed by: %(link)s\n %(subject)s\n" % dict(subject=subject, link=link) + changed = True + + if changed: spec.whiteboard = wb spec.lp_save() @@ -92,7 +103,7 @@ def find_specs(launchpad, dbconn, args): specs |= set([topic]) for spec in specs: - update_spec(launchpad, args.project, spec, subject, args.change_url) + update_spec(launchpad, args.project, spec, subject, args.change_url, spec==topic) def main(): parser = argparse.ArgumentParser()