INNER CODE UNIT · Python

print_diff

lissy93/portainer-templates · lib/changelog.py:128

def print_diff(old_tag, new_tag):
    """Print one tag-to-tag diff as JSON, for the release notes in release.yml.
    An empty old_tag, or one with no templates.json, counts as a first release."""
    new = templates_at(new_tag)
    if new is None:
        log.error(f'No templates.json at {new_tag}, nothing to diff')
        sys.exit(1)
    old = templates_at(old_tag) if old_tag else {}
    if old is None:
        log.warning(f'No templates.json at {old_tag}, treating as a first release')
        old = {}
    added, removed, renamed, updated = diff(old, new)
    chain = renames_between(old_tag, old, new_tag) if old else {}
    for title in list(removed):
        landed = final_title(chain, title)
        if landed in added:
            renamed.append({'from': title, 'to': landed})
            added.remove(landed)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…