Make list-changes smarter

If we can't figure out the previous version from looking in the YAML
file, use git describe to find it.

Show the version number being released in the header of the list-changes
output so we can verify that it matches the expected value after seeing
what sorts of changes are included.

Change-Id: I8f65400900ee0779fd8d1736bf319e638ebbeca0
This commit is contained in:
Doug Hellmann 2015-08-24 18:17:01 +00:00
parent 488d561077
commit 33dc32f776
2 changed files with 22 additions and 7 deletions

View File

@ -109,12 +109,6 @@ def main():
(project['repo'], new_release['version']))
continue
if previous_release:
git_range = '%s..%s' % (previous_release['version'],
project['hash'])
else:
git_range = project['hash']
# Check out the code.
subprocess.check_call(
['zuul-cloner',
@ -125,9 +119,23 @@ def main():
]
)
start_range = previous_release
if not start_range:
start_range = (
gitutils.get_latest_tag(workdir, project['repo'])
or
None
)
if start_range:
git_range = '%s..%s' % (start_range, project['hash'])
else:
git_range = project['hash']
# Show the changes since the last release.
git_log(workdir, project['repo'],
'Release will include', git_range)
'Release %s will include' % new_release['version'],
git_range)
# If the sha for HEAD and the requested release don't
# match, show any unreleased changes on the branch. We ask

View File

@ -87,3 +87,10 @@ def check_ancestry(workdir, repo, old_version, sha):
cwd=os.path.join(workdir, repo),
).strip()
return bool(ancestors)
def get_latest_tag(workdir, repo):
return subprocess.check_output(
['git', 'describe', '--abbrev=0'],
cwd=os.path.join(workdir, repo),
).strip()