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:
parent
488d561077
commit
33dc32f776
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user