Writes the changelog

    Args:
        amend: amend last commit with changes
        stage: stage changes
        next_version: indicates next version
        auto_next_version: infer next version from VCS
510630
def chglog(amend: bool = False, stage: bool = False, next_version: str = None, auto_next_version: bool = False):
    
    changed_files = CTX.repo.changed_files()
    changelog_file_path: Path = config.CHANGELOG_FILE_PATH()
    changelog_file_name = changelog_file_path.name
    if changelog_file_name in changed_files:
        LOGGER.error('changelog has changed; cannot update it')
        exit(-1)
    _chglog(amend, stage, next_version, auto_next_version)
1256827
def revert(self, version, url):
        
        message = "Draft replaced with %s version. This revert has not been published." % version.date_published
        version.make_draft()

        # Log action as a save
        self.log_action(self.object, CMSLog.SAVE, url=url)
        return self.write_message(message=message)
69300
def generate_changelog(context):
    """"""

    changelog_content = [
        '\n## [%s](%s/compare/%s...%s)\n\n'
        % (
            context.new_version,
            context.repo_url,
            context.current_version,
            context.new_version,
        )
    ]

    git_log_content = None
    git_log = 'log --oneline --no-merges --no-color'.split(' ')
    try:
        git_log_tag = git_log + ['%s..master' % context.current_version]
        git_log_content = git(git_log_tag)
        log.debug('content: %s' % git_log_content)
    except Exception:
        log.warn('Error diffing previous version, initial release')
        git_log_content = git(git_log)

    git_log_content = replace_sha_with_commit_link(context.repo_url, git_log_content)
    # turn change log entries into markdown bullet points
    if git_log_content:
        [
            changelog_content.append('* %s\n' % line) if line else line
            for line in git_log_content[:-1]
        ]

    write_new_changelog(
        context.repo_url, 'CHANGELOG.md', changelog_content, dry_run=context.dry_run
    )
    log.info('Added content to CHANGELOG.md')
    context.changelog_content = changelog_content
233227
def _versions_from_changelog(changelog):
    
    versions = [Version(x) for x in changelog if BUGFIX_RELEASE_RE.match(x)]
    return sorted(versions)
524137
function addVersionJSONToChangelog(version, changes) {
	if (!changelog) readChangelog();
	var entry = '\n\n## ' + version;

	changes.forEach(function(change) {
		entry += '\n* ' + change.type + ': ' + change.category + ': ' +
			change.description;
	});

	var logParts = changelog.split(insertMarker);
	logParts[0] = logParts[0]
		.replace(versionMarkerReg, versionMarker.join(version)) + insertMarker;
	changelog = logParts.join(entry);
}
807587
def update_version_records(self):
        
        from .__init__ import __version__ as version
        with self.connection(commit=True) as connection:
            for vrec in self.get_version_records():
                if (vrec.rash_version == version and
                    vrec.schema_version == schema_version):
                    return  # no need to insert the new one!
            connection.execute(
                'INSERT INTO rash_info (rash_version, schema_version) '
                'VALUES (?, ?)',
                [version, schema_version])
179765
def update_version(self, version, step=1):
        ""

        # update the version based on the flags passed.
        if self.config.patch:
            version.patch += step
        if self.config.minor:
            version.minor += step
        if self.config.major:
            version.major += step
        if self.config.build:
            version.build_number += step
        if self.config.build_number:
            version.build_number = self.config.build_number

        # create a new tag in the repo with the new version.
        if self.config.dry_run:
            log.info('Not updating repo to version {0}, because of --dry-run'.format(version))
        else:
            version = self.call_plugin_function('set_version', version)

        return version
715233
def do_changed(self, subcmd, opts, component):
        

        releases = get_released_versions(component)
        latest = releases[0]

        filter_dir = components.comp_names[component].path

        latest_tag = '-'.join(latest)
        data = get_changed_since_tag(latest_tag, filter_dir)

        if len(data) > 0:
            print(data)
569724
def prepare_release(ver=None):
    """"""
    write_changelog(True)
    if ver is None:
        ver = next_release()
    print('saving updates to ChangeLog')
    run('git commit ChangeLog -m "[RELEASE] Update to version v{}"'.format(ver), hide=True)
    sha = run('git log -1 --pretty=format:"%h"', hide=True).stdout
    run('git tag -a "{ver}" -m "version {ver}" {sha}'.format(ver=ver, sha=sha), hide=True)
    package()
    write_changelog()
    run('git tag -d {}'.format(ver), hide=True)
    run('git commit --all --amend --no-edit', hide=True)
521371
def _update_version(self):
        """"""
        #current = self.vcs.version
        current = self.data['new_version']

        # Clean it up to a non-development version.
        current = utils.cleanup_version(current)
        # Try to make sure that the suggestion for next version after
        # 1.1.19 is not 1.1.110, but 1.1.20.
        current_split = current.split('.')
        major = '.'.join(current_split[:-1])
        minor = current_split[-1]
        try:
            minor = int(minor) + 1
            suggestion = '.'.join([major, str(minor)])
        except ValueError:
            # Fall back on simply updating the last character when it is
            # an integer.
            try:
                last = int(current[-1]) + 1
                suggestion = current[:-1] + str(last)
            except ValueError:
                logger.warn("Version does not end with a number, so we can't "
                            "calculate a suggestion for a next version.")
                suggestion = None
        print("Current version is %r" % current)
        q = "Enter new development version ('.dev0' will be appended)"
        version = utils.ask_version(q, default=suggestion)
        if not version:
            version = suggestion
        if not version:
            logger.error("No version entered.")
            sys.exit()

        self.data['new_version'] = version
        dev_version = self.data['dev_version_template'] % self.data
        self.data['dev_version'] = dev_version
        logger.info("New version string is %r",
                    dev_version)

        self.vcs.version = self.data['dev_version']
1185253
function() {
        if (!version) return;
        if (note) version.notes.push(note);

        version.rawNote = normText(
            _.chain(version.notes)
            .map(function(note) {
                return '* '+note.trim();
            })
            .value()
            .join('\n')
        );
        version.notes = _.map(version.notes, normText);
        changelog.versions.push(version);

        note = "";
        version = null;
    }
283454
def revision(directory, message, autogenerate, sql, head, splice, branch_label,
             version_path, rev_id):
    """"""
    _revision(directory, message, autogenerate, sql, head, splice,
              branch_label, version_path, rev_id)
690583
@RequestMapping(value = "changelog/{uuid}/revisions", method = RequestMethod.GET)
    public SVNChangeLogRevisions changeLogRevisions(@PathVariable String uuid) {
        // Gets the change log
        SVNChangeLog changeLog = getChangeLog(uuid);
        // Cached?
        SVNChangeLogRevisions revisions = changeLog.getRevisions();
        if (revisions != null) {
            return revisions;
        }
        // Loads the revisions
        revisions = changeLogService.getChangeLogRevisions(changeLog);
        // Stores in cache
        logCache.put(uuid, changeLog.withRevisions(revisions));
        // OK
        return revisions;
    }
290993
def apply_patch(diffs):
    
    pass

    if isinstance(diffs, patch.diff):
        diffs = [diffs]

    for diff in diffs:
        if diff.header.old_path == '/dev/null':
            text = []
        else:
            with open(diff.header.old_path) as f:
                text = f.read()

        new_text = apply_diff(diff, text)
        with open(diff.header.new_path, 'w') as f:
            f.write(new_text)
791774
def amend_commit_message(self, cherry_pick_branch):
        

        commit_prefix = ""
        if self.prefix_commit:
            commit_prefix = f"[{get_base_branch(cherry_pick_branch)}] "
        updated_commit_message = f"""{commit_prefix}{self.get_commit_message(self.commit_sha1)}
(cherry picked from commit {self.commit_sha1})


Co-authored-by: {get_author_info_from_short_sha(self.commit_sha1)}"""
        if self.dry_run:
            click.echo(f"  dry-run: git commit --amend -m '{updated_commit_message}'")
        else:
            cmd = ["git", "commit", "--amend", "-m", updated_commit_message]
            try:
                subprocess.check_output(cmd, stderr=subprocess.STDOUT)
            except subprocess.CalledProcessError as cpe:
                click.echo("Failed to amend the commit message \u2639")
                click.echo(cpe.output)
        return updated_commit_message
847400
def changelog():
    # type: () -> str
    
    # Skip 'v' prefix
    versions = [x for x in git.tags() if versioning.is_valid(x[1:])]

    cmd = 'git log --format=%H'
    if versions:
        cmd += ' {}..HEAD'.format(versions[-1])

    hashes = shell.run(cmd, capture=True).stdout.strip().splitlines()
    commits = [git.CommitDetails.get(h) for h in hashes]

    tags = conf.get('changelog.tags', [
        {'header': 'Features', 'tag': 'feature'},
        {'header': 'Changes', 'tag': 'change'},
        {'header': 'Fixes', 'tag': 'fix'},
    ])

    results = OrderedDict((
        (x['header'], []) for x in tags
    ))

    for commit in commits:
        commit_items = extract_changelog_items(commit.desc, tags)
        for header, items in commit_items.items():
            results[header] += items

    lines = [
        '<35>v{}<0>'.format(versioning.current()),
        '',
    ]
    for header, items in results.items():
        if items:
            lines += [
                '',
                '<32>{}<0>'.format(header),
                '<32>{}<0>'.format('-' * len(header)),
                '',
            ]
            for item_text in items:
                item_lines = textwrap.wrap(item_text, 77)
                lines += ['- {}'.format('\n  '.join(item_lines))]

            lines += ['']

    return '\n'.join(lines)
1177160
public void addChangeLog(File changelogFile) throws IOException, ChangelogParseException {
		// parse the change log to a list of entries
		InputStream changelog = new FileInputStream(changelogFile);
		ChangelogParser parser = new ChangelogParser();
		List<ChangelogEntry> entries = parser.parse(changelog);
		for (ChangelogEntry entry : entries) {
			addChangeLogEntry(entry);
		}
	}