change version numbers inside processing function as well
This commit is contained in:
Родитель
8e4a6c7a90
Коммит
e0c2b0a8a0
|
@ -175,7 +175,7 @@ def get_today_string():
|
|||
today = datetime.datetime.today()
|
||||
return '{:%d %b %Y}'.format(today)
|
||||
|
||||
def process_changelog_for_backports(target_version):
|
||||
def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):
|
||||
|
||||
# changelog entries use a speficic format to indicate
|
||||
# that they only apply to newer versions
|
||||
|
@ -191,6 +191,7 @@ def process_changelog_for_backports(target_version):
|
|||
|
||||
output += line + '\n'
|
||||
if line.startswith('## '):
|
||||
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
|
||||
# we have found the first section, so now handle things differently
|
||||
break
|
||||
|
||||
|
@ -206,10 +207,11 @@ def process_changelog_for_backports(target_version):
|
|||
# filter out changenote entries that apply only to newer versions
|
||||
match = regex.search(line)
|
||||
if match:
|
||||
if int(target_version) < int(match.group(1)):
|
||||
if int(target_branch_major_version) < int(match.group(1)):
|
||||
continue
|
||||
|
||||
if line.startswith('## '):
|
||||
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
|
||||
if found_content == False:
|
||||
# we have found two headings in a row, so we need to add the placeholder message.
|
||||
output += 'No user facing changes.\n'
|
||||
|
@ -375,10 +377,7 @@ def main():
|
|||
|
||||
# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
|
||||
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
|
||||
subprocess.check_output(['sed', '-i', f's/^## {source_branch_major_version}\./## {target_branch_major_version}./g', 'CHANGELOG.md'])
|
||||
|
||||
# process changelog for backport to target release branch
|
||||
process_changelog_for_backports(target_branch_major_version)
|
||||
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)
|
||||
|
||||
# Amend the commit generated by `npm version` to update the CHANGELOG
|
||||
run_git('add', 'CHANGELOG.md')
|
||||
|
|
Загрузка…
Ссылка в новой задаче