only generate new release information, if there is a new release
When running new_release, I've found that it'll generate a new entry with a new release number and the old sha if there are no intervening changes. This proposed code will change that behavior and not generate a new project deliverable file if there is no difference from the previous one. I find this useful when I run the new release command for multiple projects and branches in that if there are no changes to tag, it generates no output file. I'm not positive that this change is all good; for example, I don't know for sure that there are not situations where one would want to tag a new release even if there are no changes. Change-Id: I351ada42dde757f29094462b10011ec4f375d465
This commit is contained in:
parent
af59f5785b
commit
bfb12391b7
|
@ -102,6 +102,7 @@ def main():
|
|||
print('going from %s to %s' % (last_version, new_version))
|
||||
|
||||
projects = []
|
||||
changes = 0
|
||||
for project in last_release['projects']:
|
||||
gitutils.clone_repo(workdir, project['repo'])
|
||||
|
||||
|
@ -112,14 +113,21 @@ def main():
|
|||
version = 'master'
|
||||
|
||||
sha = gitutils.sha_for_tag(workdir, project['repo'], version)
|
||||
projects.append({
|
||||
'repo': project['repo'],
|
||||
'hash': sha,
|
||||
})
|
||||
if project['hash'] != sha:
|
||||
changes += 1
|
||||
print('advancing %s from %s to %s' % (project['repo'],
|
||||
project['hash'],
|
||||
sha))
|
||||
projects.append({
|
||||
'repo': project['repo'],
|
||||
'hash': sha,
|
||||
})
|
||||
|
||||
# The YAML dump formatter produces results that aren't very nice
|
||||
# to read, so we format the output ourselves.
|
||||
with open(deliverable_filename, 'a') as f:
|
||||
f.write(RELEASE_TEMPLATE.format(version=new_version))
|
||||
for p in projects:
|
||||
f.write(PROJECT_TEMPLATE.format(**p))
|
||||
# to read, so we format the output ourselves. The file is only
|
||||
# regenerated if there are in fact changes to be made.
|
||||
if changes > 0:
|
||||
with open(deliverable_filename, 'a') as f:
|
||||
f.write(RELEASE_TEMPLATE.format(version=new_version))
|
||||
for p in projects:
|
||||
f.write(PROJECT_TEMPLATE.format(**p))
|
||||
|
|
Loading…
Reference in New Issue