diff --git a/gerrit/update_blueprint.py b/gerrit/update_blueprint.py index 2dba6bd6..59b7a144 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, topic=False): +def update_spec(launchpad, project, name, subject, link, topic=None): # For testing, if a project doesn't match openstack/foo, use # the openstack-ci project instead. group, project = project.split('/') @@ -72,7 +72,7 @@ def update_spec(launchpad, project, name, subject, link, topic=False): changed = False if topic: topiclink = '%s/#q,topic:%s,n,z' % (link[:link.find('/',8)], - name) + topic) if topiclink not in wb: wb += "\n\n\nGerrit topic: %(link)s" % dict(link=topiclink) changed = True @@ -99,11 +99,12 @@ def find_specs(launchpad, dbconn, args): specs = set([m.group(2) for m in SPEC_RE.finditer(git_log)]) if topic: - topic = topic.split('/')[-1] - specs |= set([topic]) + topicspec = topic.split('/')[-1] + specs |= set([topicspec]) for spec in specs: - update_spec(launchpad, args.project, spec, subject, args.change_url, spec==topic) + update_spec(launchpad, args.project, spec, subject, + args.change_url, topic) def main(): parser = argparse.ArgumentParser() diff --git a/tools/rfc.sh b/tools/rfc.sh index 35183c78..f2fbfd2c 100755 --- a/tools/rfc.sh +++ b/tools/rfc.sh @@ -85,7 +85,7 @@ rebase_changes() { git fetch; - GIT_EDITOR=/bin/true git rebase -i origin/$branch; + GIT_EDITOR=/bin/true git rebase -i origin/$branch || exit $?; } @@ -106,7 +106,9 @@ main() assert_diverge; - bug=$(git show --format='%s %b' | perl -nle '/\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)/ && print "$2"') + bug=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)/) {print "$2"; exit}') + + bp=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]lue[Pp]rint|[Bb][Pp])\s*[#:]?\s*([0-9a-zA-Z-_]+)/) {print "$2"; exit}') if [ "$DRY_RUN" = 1 ]; then drier='echo -e Please use the following command to send your commits to review:\n\n' @@ -116,7 +118,11 @@ main() local_branch=`git branch | grep -Ei "\* (.*)" | cut -f2 -d' '` if [ -z "$bug" ]; then - $drier git push gerrit HEAD:refs/for/$branch/$local_branch; + if [ -z "$bp" ]; then + $drier git push gerrit HEAD:refs/for/$branch/$local_branch; + else + $drier git push gerrit HEAD:refs/for/$branch/bp/$bp; + fi else $drier git push gerrit HEAD:refs/for/$branch/bug/$bug; fi