show unreleased changes as well as released changes

Sometimes we want to release something that isn't HEAD, so include the
unreleased changes in the output report.

Change-Id: I7265e892dff48a2c0a618f6d3b2a9ceff6e095bf
This commit is contained in:
Doug Hellmann
2015-08-13 18:22:34 +00:00
parent f39c3879ad
commit 01834f3146

View File

@@ -31,6 +31,18 @@ from openstack_releases import defaults
from openstack_releases import gitutils from openstack_releases import gitutils
def git_log(title, git_range):
header = '%s %s' % (title, git_range)
print('\n%s' % header)
print('-' * len(header))
subprocess.check_call([
'git', 'log', '--no-color',
'--format=%h %ci %s', '--no-merges',
git_range,
])
print()
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@@ -113,20 +125,35 @@ def main():
project['repo'], project['repo'],
] ]
) )
header = '%s %s' % (project['repo'], git_range)
print('\n%s' % header)
print('-' * len(header))
# Show the log output. # Move into the repository we just checked out.
log_cmd = [ os.chdir(os.path.join(workdir, project['repo']))
'git', 'log', '--no-color',
'--format=%h %ci %s', '--no-merges', # Show the changes since the last release.
git_range, git_log('Release will include', git_range)
]
subprocess.check_call( # If the sha for HEAD and the requested release don't
log_cmd, # match, show any unreleased changes on the branch. We ask
cwd=os.path.join(workdir, project['repo']), # 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(
'Release will NOT include',
'%s..%s' % (requested_sha, head_sha),
)
# Show more details about the commit being tagged.
print() print()
print('git describe %s' % project['hash'])
subprocess.check_call(['git', 'describe', project['hash']])
return 0 return 0