new-branch: Add check for branch name before adding
If quickly scanning the command line arguments for the new-release tool, it may not be obvious that --stable-branch is only needed one time when initially creating the stable branch, not every time doing a release off of a stable branch. This adds a check to make sure the stable branch does not already exist in the deliverable file before attempting to add the branch directive for the current release. Change-Id: Ib15aae2530eb9aebaad23d249dc3d59b022a6d46
This commit is contained in:
@@ -244,11 +244,24 @@ def main():
|
|||||||
'version': new_version,
|
'version': new_version,
|
||||||
'projects': projects,
|
'projects': projects,
|
||||||
})
|
})
|
||||||
|
|
||||||
if add_stable_branch:
|
if add_stable_branch:
|
||||||
deliverable_info.setdefault('branches', []).append({
|
branch_name = 'stable/{}'.format(series)
|
||||||
'name': 'stable/{}'.format(series),
|
|
||||||
'location': new_version,
|
# First check if this branch is already defined
|
||||||
})
|
if 'branches' in deliverable_info:
|
||||||
|
for branch in deliverable_info['branches']:
|
||||||
|
if branch.get('name') == branch_name:
|
||||||
|
print('Branch {} already existes, skipping'.format(
|
||||||
|
branch_name))
|
||||||
|
add_stable_branch = False
|
||||||
|
break
|
||||||
|
|
||||||
|
if add_stable_branch:
|
||||||
|
deliverable_info.setdefault('branches', []).append({
|
||||||
|
'name': branch_name,
|
||||||
|
'location': new_version,
|
||||||
|
})
|
||||||
|
|
||||||
if changes > 0:
|
if changes > 0:
|
||||||
deliverable_filename = 'deliverables/%s/%s.yaml' % (
|
deliverable_filename = 'deliverables/%s/%s.yaml' % (
|
||||||
|
|||||||
Reference in New Issue
Block a user