def get_changelog_summary(release_tag): summary = "" for package in get_packages().values(): release_branch = '/'.join(release_tag.split('/')[:-1]).format(package=package.name) if not branch_exists(release_branch): continue with inbranch(release_branch): changelog = get_changelog_from_path(os.getcwd()) if changelog is None: continue for version, date, changes in changelog.foreach_version(): if version == package.version: msgs = [] for change in changes: msgs.extend([i for i in to_unicode(change).splitlines()]) msg = '\n'.join(msgs) summary += """ ## {package.name} """.format(**locals()) if msg: summary += """ ``` {msg} ``` """.format(**locals()) else: summary += """ - No changes """ return summary
def get_changelogs(package, releaser_history=None): if releaser_history is None: warning( "No historical releaser history, using current maintainer name " "and email for each versioned changelog entry.") releaser_history = {} if is_debug(): import logging logging.basicConfig() import catkin_pkg catkin_pkg.changelog.log.setLevel(logging.DEBUG) package_path = os.path.abspath(os.path.dirname(package.filename)) changelog_path = os.path.join(package_path, CHANGELOG_FILENAME) if os.path.exists(changelog_path): changelog = get_changelog_from_path(changelog_path) changelogs = [] maintainer = (package.maintainers[0].name, package.maintainers[0].email) for version, date, changes in changelog.foreach_version(reverse=True): changes_str = [] date_str = get_rfc_2822_date(date) for item in changes: changes_str.extend( [' ' + i for i in to_unicode(item).splitlines()]) # Each entry has (version, date, changes, releaser, releaser_email) releaser, email = releaser_history.get(version, maintainer) changelogs.append( (version, date_str, '\n'.join(changes_str), releaser, email)) return changelogs else: warning("No {0} found for package '{1}'".format( CHANGELOG_FILENAME, package.name)) return []
def get_changelogs(package, releaser_history=None): if releaser_history is None: warning("No historical releaser history, using current maintainer name " "and email for each versioned changelog entry.") releaser_history = {} if is_debug(): import logging logging.basicConfig() import catkin_pkg catkin_pkg.changelog.log.setLevel(logging.DEBUG) package_path = os.path.abspath(os.path.dirname(package.filename)) changelog_path = os.path.join(package_path, CHANGELOG_FILENAME) if os.path.exists(changelog_path): changelog = get_changelog_from_path(changelog_path) changelogs = [] maintainer = (package.maintainers[0].name, package.maintainers[0].email) for version, date, changes in changelog.foreach_version(reverse=True): changes_str = [] date_str = get_rfc_2822_date(date) for item in changes: changes_str.extend([' ' + i for i in to_unicode(item).splitlines()]) # Each entry has (version, date, changes, releaser, releaser_email) releaser, email = releaser_history.get(version, maintainer) changelogs.append(( version, date_str, '\n'.join(changes_str), releaser, email )) return changelogs else: warning("No {0} found for package '{1}'" .format(CHANGELOG_FILENAME, package.name)) return []