Merge "Better handling of newton branch in osa-differ"

This commit is contained in:
Jenkins 2016-07-28 17:14:59 +00:00 committed by Gerrit Code Review
commit 840528242a
2 changed files with 26 additions and 11 deletions

View File

@ -125,19 +125,27 @@ def render_commit_template(user, repo, old_commit, new_commit, extra_vars={},
# Compare the two commits in the project's repository to see what # Compare the two commits in the project's repository to see what
# the differences are between them. # the differences are between them.
if old_commit == new_commit:
logger.debug("Same starting and ending commit ({0}) for {1}/{2} - "
"nothing to compare".format(short_commit(old_commit),
user, repo))
commits = []
else:
logger.debug("Retrieving commits between {2} and {3} in " logger.debug("Retrieving commits between {2} and {3} in "
"{0}/{1}".format(user, repo, old_commit, new_commit)) "{0}/{1}".format(user, repo, short_commit(old_commit),
short_commit(new_commit)))
comparison = gh.repos.commits.compare( comparison = gh.repos.commits.compare(
user=user, user=user,
repo=repo, repo=repo,
base=old_commit, base=old_commit,
head=new_commit head=new_commit
) )
commits = comparison.commits
# Render the jinja2 template # Render the jinja2 template
rendered_template = jinja_env.get_template(template_file).render( rendered_template = jinja_env.get_template(template_file).render(
repo=repo, repo=repo,
commits=comparison.commits, commits=commits,
latest_sha=short_commit(new_commit), latest_sha=short_commit(new_commit),
older_sha=short_commit(old_commit), older_sha=short_commit(old_commit),
extra_vars=extra_vars extra_vars=extra_vars
@ -288,8 +296,11 @@ if __name__ == "__main__":
# Determine the older and newer SHA for this role # Determine the older and newer SHA for this role
latest_sha = role['version'] latest_sha = role['version']
try:
older_sha = next(x['version'] for x in old_role_yaml older_sha = next(x['version'] for x in old_role_yaml
if x['name'] == role['name']) if x['name'] == role['name'])
except StopIteration:
older_sha = latest_sha
# Render a template showing the commits in this role's repository. # Render a template showing the commits in this role's repository.
report += render_commit_template( report += render_commit_template(

View File

@ -1,6 +1,10 @@
{{ repo }} {{ repo }}
{% if repo == 'openstack-ansible' %}
{{ '-' * repo | length}}
{% else %}
{{ '~' * repo | length}} {{ '~' * repo | length}}
{% endif %}
{% if commits | length < 1 %} {% if commits | length < 1 %}
No commits were found in `{{ repo }} <https://github.com/openstack/{{ repo }}>`_ No commits were found in `{{ repo }} <https://github.com/openstack/{{ repo }}>`_