From c9b3715c82cc680dbccb5a3484406087a206369f Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 3 Mar 2016 16:32:58 -0500 Subject: [PATCH] move the check for the SHA to match HEAD earlier Move the check that tells us if the SHA matches HEAD earlier, along with the other info about the commit being tagged. Change-Id: I2ec290ef5553036ac1baf5109aea7aa98ea97f53 Signed-off-by: Doug Hellmann --- openstack_releases/cmds/list_changes.py | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/openstack_releases/cmds/list_changes.py b/openstack_releases/cmds/list_changes.py index 7652b53fc6..d78ffd4184 100644 --- a/openstack_releases/cmds/list_changes.py +++ b/openstack_releases/cmds/list_changes.py @@ -190,6 +190,25 @@ def main(): ref=project['hash'], ) + head_sha = gitutils.sha_for_tag(workdir, project['repo'], 'HEAD') + requested_sha = gitutils.sha_for_tag( + workdir, + project['repo'], + project['hash'], + ) + # If the sha for HEAD and the requested release don't + # match, show any unreleased changes on the branch. We ask + # git to give us the real SHA for the requested release in + # case the deliverables file has the short version of the + # hash. + header('Relationship to HEAD') + if head_sha == requested_sha: + print('\nRequest releases from HEAD on %s' % branch) + else: + git_log(workdir, project['repo'], 'Release will NOT include', + '%s..%s' % (requested_sha, head_sha), + extra_args=['--format=%h %ci %s']) + # Show any requirements changes in the upcoming release. if start_range: git_diff(workdir, project['repo'], git_range, '*requirements*.txt') @@ -207,24 +226,6 @@ def main(): git_range, extra_args=['--no-merges', '--topo-order']) - # If the sha for HEAD and the requested release don't - # match, show any unreleased changes on the branch. We ask - # git to give us the real SHA for the requested release in - # case the deliverables file has the short version of the - # hash. - head_sha = gitutils.sha_for_tag(workdir, project['repo'], 'HEAD') - requested_sha = gitutils.sha_for_tag( - workdir, - project['repo'], - project['hash'], - ) - if head_sha == requested_sha: - print('Request releases from HEAD on %s' % branch) - else: - git_log(workdir, project['repo'], 'Release will NOT include', - '%s..%s' % (requested_sha, head_sha), - extra_args=['--format=%h %ci %s']) - # Show any changes in the previous release but not in this # release, in case someone picks an "early" SHA or a # regular commit instead of the appropriate merge commit.