From defc0e7aa42b4a5cd983b5fd3214e75e391cd786 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 25 Nov 2015 20:27:36 +0000 Subject: [PATCH] protect list-changes from new repos in a deliverable When new repositories are added to a deliverable, we want to recognize them as new and show all of the changes. The existing logic using the generator expression fails with a StopIteration exception when there is no repository matching the new version in the previous version. Change-Id: Ifb426b89c85b21b18208a630fa5187a279e6ce2f --- openstack_releases/cmds/list_changes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openstack_releases/cmds/list_changes.py b/openstack_releases/cmds/list_changes.py index 76c2480e28..0099269c01 100644 --- a/openstack_releases/cmds/list_changes.py +++ b/openstack_releases/cmds/list_changes.py @@ -140,10 +140,12 @@ def main(): start_range = None if previous_release: - projects = previous_release['projects'] - previous_project = next(x for x in projects - if x['repo'] == project['repo']) - start_range = previous_project['hash'] + previous_project = { + x['repo']: x + for x in previous_release['projects'] + }.get(project['repo']) + if previous_project is not None: + start_range = previous_project['hash'] if not start_range: start_range = ( gitutils.get_latest_tag(workdir, project['repo'])