improve list-changes handling for first releases

Before this change we always had a start revision value because
get_latest_tag() returned a SHA if it didn't have a real tag. The way
that SHA is determined leads to not including all changes in the
report about the release, so we don't want to use the value. This
change allows get_latest_tag() to return None and in that case use an
empty starting point for the diff range when computing the release
notes contents.

Change-Id: I7403b0ab2264ef7828c012a943cf093da2951d68
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2019-01-07 10:26:36 -05:00
parent 759867bae0
commit f8b4412fae
2 changed files with 8 additions and 4 deletions

View File

@ -393,7 +393,8 @@ def main():
previous_tag = gitutils.get_latest_tag(
workdir,
project.repo.name,
'{}^'.format(project.hash)
'{}^'.format(project.hash),
always=False,
)
try:
previous_release = deliv.get_release(previous_tag)
@ -582,7 +583,7 @@ def main():
notes = release_notes.generate_release_notes(
repo=project.repo.name,
repo_path=os.path.join(workdir, project.repo.name),
start_revision=new_release.diff_start or start_range,
start_revision=new_release.diff_start or start_range or '',
end_revision=new_release.version,
show_dates=True,
skip_requirement_merges=True,

View File

@ -262,10 +262,13 @@ def check_ancestry(workdir, repo, old_version, sha):
return False
def get_latest_tag(workdir, repo, sha=None):
cmd = ['git', 'describe', '--abbrev=0', '--always']
def get_latest_tag(workdir, repo, sha=None, always=True):
cmd = ['git', 'describe', '--abbrev=0']
if always:
cmd.append('--always')
if sha is not None:
cmd.append(sha)
LOG.debug(' '.join(cmd))
try:
return processutils.check_output(
cmd,