Generates the changelog since the last release.
    :raises ImproperConfigurationError: if there is no current version
16195
def changelog(**kwargs):
    
    current_version = get_current_version()
    debug('changelog got current_version', current_version)

    if current_version is None:
        raise ImproperConfigurationError(
            "Unable to get the current version. "
            "Make sure semantic_release.version_variable "
            "is setup correctly"
        )
    previous_version = get_previous_version(current_version)
    debug('changelog got previous_version', previous_version)

    log = generate_changelog(previous_version, current_version)
    click.echo(markdown_changelog(current_version, log, header=False))

    debug('noop={}, post={}'.format(kwargs.get('noop'), kwargs.get('post')))
    if not kwargs.get('noop') and kwargs.get('post'):
        if check_token():
            owner, name = get_repository_owner_and_name()
            click.echo('Updating changelog')
            post_changelog(
                owner,
                name,
                current_version,
                markdown_changelog(current_version, log, header=False)
            )
        else:
            click.echo(
                click.style('Missing token: cannot post changelog', 'red'), err=True)
241164
def run_refresh(args):
    
    image = args.image
    branch = args.branch

    try:
        initial_version = get_latest_version(image, branch)
    except DockerTagNamingException, de:
        print(de)
        sys.exit(1)

    if initial_version is None:
        print('No version found')
        sys.exit(1)

    print('Initial version is %s , waiting for new release...' % initial_version)

    for _ in xrange(120):
        time.sleep(1)

        try:
            version = get_latest_version(image, branch)
        except DockerTagNamingException, de:
            print(de)
            sys.exit(1)

        if version.version_number != initial_version.version_number:
            print('New version found: %s' % version)
            sys.exit(0)

    print('Timeout: version did not change.')
    sys.exit(0)
591373
def _log_python_version(self):
        """"""
        self.log.info(
            u'Python Version: {}.{}.{}'.format(
                sys.version_info.major, sys.version_info.minor, sys.version_info.micro
            )
        )
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)
608818
def build_update(self,
                     alias=None,
                     assigned_to=None,
                     blocks_add=None,
                     blocks_remove=None,
                     blocks_set=None,
                     depends_on_add=None,
                     depends_on_remove=None,
                     depends_on_set=None,
                     cc_add=None,
                     cc_remove=None,
                     is_cc_accessible=None,
                     comment=None,
                     comment_private=None,
                     component=None,
                     deadline=None,
                     dupe_of=None,
                     estimated_time=None,
                     groups_add=None,
                     groups_remove=None,
                     keywords_add=None,
                     keywords_remove=None,
                     keywords_set=None,
                     op_sys=None,
                     platform=None,
                     priority=None,
                     product=None,
                     qa_contact=None,
                     is_creator_accessible=None,
                     remaining_time=None,
                     reset_assigned_to=None,
                     reset_qa_contact=None,
                     resolution=None,
                     see_also_add=None,
                     see_also_remove=None,
                     severity=None,
                     status=None,
                     summary=None,
                     target_milestone=None,
                     target_release=None,
                     url=None,
                     version=None,
                     whiteboard=None,
                     work_time=None,
                     fixed_in=None,
                     qa_whiteboard=None,
                     devel_whiteboard=None,
                     internal_whiteboard=None,
                     sub_component=None,
                     flags=None,
                     comment_tags=None):
        
        ret = {}

        # These are only supported for rhbugzilla
        for key, val in [
            ("fixed_in", fixed_in),
            ("devel_whiteboard", devel_whiteboard),
            ("qa_whiteboard", qa_whiteboard),
            ("internal_whiteboard", internal_whiteboard),
            ("sub_component", sub_component),
        ]:
            if val is not None:
                raise ValueError("bugzilla instance does not support "
                                 "updating '%s'" % key)

        def s(key, val, convert=None):
            if val is None:
                return
            if convert:
                val = convert(val)
            ret[key] = val

        def add_dict(key, add, remove, _set=None, convert=None):
            if add is remove is _set is None:
                return

            def c(val):
                val = self._listify(val)
                if convert:
                    val = [convert(v) for v in val]
                return val

            newdict = {}
            if add is not None:
                newdict["add"] = c(add)
            if remove is not None:
                newdict["remove"] = c(remove)
            if _set is not None:
                newdict["set"] = c(_set)
            ret[key] = newdict


        s("alias", alias)
        s("assigned_to", assigned_to)
        s("is_cc_accessible", is_cc_accessible, bool)
        s("component", component)
        s("deadline", deadline)
        s("dupe_of", dupe_of, int)
        s("estimated_time", estimated_time, int)
        s("op_sys", op_sys)
        s("platform", platform)
        s("priority", priority)
        s("product", product)
        s("qa_contact", qa_contact)
        s("is_creator_accessible", is_creator_accessible, bool)
        s("remaining_time", remaining_time, float)
        s("reset_assigned_to", reset_assigned_to, bool)
        s("reset_qa_contact", reset_qa_contact, bool)
        s("resolution", resolution)
        s("severity", severity)
        s("status", status)
        s("summary", summary)
        s("target_milestone", target_milestone)
        s("target_release", target_release)
        s("url", url)
        s("version", version)
        s("whiteboard", whiteboard)
        s("work_time", work_time, float)
        s("flags", flags)
        s("comment_tags", comment_tags, self._listify)

        add_dict("blocks", blocks_add, blocks_remove, blocks_set,
                 convert=int)
        add_dict("depends_on", depends_on_add, depends_on_remove,
                 depends_on_set, convert=int)
        add_dict("cc", cc_add, cc_remove)
        add_dict("groups", groups_add, groups_remove)
        add_dict("keywords", keywords_add, keywords_remove, keywords_set)
        add_dict("see_also", see_also_add, see_also_remove)

        if comment is not None:
            ret["comment"] = {"comment": comment}
            if comment_private:
                ret["comment"]["is_private"] = comment_private

        return ret
164399
def get_version():
    """"""
    try:
        tag = check_output(
            ["git", "describe", "--abbrev=0"], universal_newlines=True
        ).strip()
        assert not tag.startswith("v")
        version = tag

        # add .devNN if needed
        log = check_output(
            ["git", "log", "%s..HEAD" % tag, "--oneline"],
            universal_newlines=True,
        )
        commits_since_tag = log.count("\n")
        if commits_since_tag:
            version += ".dev%i" % commits_since_tag

        # update tcod/version.py
        open("tcod/version.py", "w").write('__version__ = "%s"\n' % version)
        return version
    except:
        exec(open("tcod/version.py").read(), globals())
        return __version__
1153971
def generate_git_version_info():
    
    info = GitInfo()
    git_path = call(('which', 'git'))

    # get build info
    info.builder = get_build_name()
    info.build_date = get_build_date()

    # parse git ID
    info.hash, info.date, info.author, info.committer = (
        get_last_commit(git_path))

    # determine branch
    info.branch = get_git_branch(git_path)

    # determine tag
    info.tag = get_git_tag(info.hash, git_path)

    # determine version
    if info.tag:
        info.version = info.tag.strip('v')
        info.release = not re.search('[a-z]', info.version.lower())
    else:
        info.version = info.hash[:6]
        info.release = False

    # Determine *last* stable release
    info.last_release = determine_latest_release_version()

    # refresh index
    call((git_path, 'update-index', '-q', '--refresh'))

    # check working copy for changes
    info.status = get_git_status(git_path)

    return info
73577
def main():
    """"""
    last_known = '0'
    if os.path.isfile(metafile):
        with open(metafile) as fh:
            last_known = fh.read()

    import mbed_cloud
    current = mbed_cloud.__version__

    # how significant a change in version scheme should trigger a new changelog entry
    # (api major, api minor, sdk major, sdk minor, sdk patch)
    sigfigs = 4
    current_version = LooseVersion(current).version
    last_known_version = LooseVersion(last_known).version

    should_towncrier = current_version[:sigfigs] != last_known_version[:sigfigs]

    print('%s -- %s :: current vs previous changelog build' % (current, last_known))
    if should_towncrier:
        print('%s >> %s :: running changelog build' % (current, last_known))
        subprocess.check_call(
            ['towncrier', '--yes'],
            cwd=os.path.join(PROJECT_ROOT, 'docs', 'changelog')
        )
        with open(metafile, 'w') as fh:
            fh.write(current)
1135787
def check_if_release_is_current(log):
    """"""
    if __version__ == '0.0.0':
        return
    client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
    latest_pypi_version = client.package_releases('hca')

    latest_version_nums = [int(i) for i in latest_pypi_version[0].split('.')]
    this_version_nums = [int(i) for i in __version__.split('.')]
    for i in range(max([len(latest_version_nums), len(this_version_nums)])):
        try:
            if this_version_nums[i] < latest_version_nums[i]:
                log.warning('WARNING: Python (pip) package "hca" is not up-to-date!\n'
                            'You have hca version:              ' + str(__version__) + '\n'
                            'Please use the latest hca version: ' + str(latest_pypi_version[0]))
            # handles the odd case where a user's current __version__ is higher than PyPi's
            elif this_version_nums[i] > latest_version_nums[i]:
                break
        # if 4.2 compared to 4.3.1, this handles the missing element
        except IndexError:
            pass
582506
def update_changelog():
    
    # description = input("Please enter a short description for this update:\n ")
    description = 'Placeholder for description here.'

    # open changelog file for appending. if doesn't exist, creates file.
    with open('changelog.txt', 'a+') as f:
        # write update line
        f.write(str(datetime.datetime.now().strftime("%d %B %Y %I:%M%p")) + '\nDescription: ' + description)
    return
1021729
def print_new_versions(strict=False):
    """"""
    new_updates = []
    same_updates = []
    for req in everything_in(all_reqs):
        new_versions = []
        same_versions = []
        for ver_str in all_versions(req):
            if newer(ver_str_to_tuple(ver_str), min_versions[req], strict=True):
                new_versions.append(ver_str)
            elif not strict and newer(ver_str_to_tuple(ver_str), min_versions[req]):
                same_versions.append(ver_str)
        update_str = req + ": " + ver_tuple_to_str(min_versions[req]) + " -> " + ", ".join(
            new_versions + ["(" + v + ")" for v in same_versions],
        )
        if new_versions:
            new_updates.append(update_str)
        elif same_versions:
            same_updates.append(update_str)
    print("\n".join(new_updates + same_updates))
829485
def up_to_date(self):
        
#        return False
        if not self.updated:
            return False
        return (utils.get_datetime_now() - self.updated).seconds < conf.GOSCALE_POSTS_UPDATE_FREQUENCY
214488
def changes
      changes = {'new' => {}, 'obsolete' => {}, 'updated' => {}}

      if @environment.nil?
        new_environments.each do |env|
          changes['new'][env] = {}
        end

        old_environments.each do |env|
          changes['obsolete'][env] = {}
        end
      else
        env = @environment
        changes['new'][env] = {} if new_environments.include?(@environment)
        changes['obsolete'][env] = {} if old_environments.include?(@environment)
      end
      changes
    end
1006545
private static boolean validateVersion(Context ctx, ChangeLog clog){

        // Get Preferences
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
        int lastSeen = prefs.getInt(PREF_CHANGELOG_LAST_SEEN, -1);

        // Second sort versions by it's code
        int latest = Integer.MIN_VALUE;
        for(Version version: clog.versions){
            if(version.code > latest){
                latest = version.code;
            }
        }

        // Get applications current version
        if(latest > lastSeen){
            if(!BuildConfig.DEBUG) prefs.edit().putInt(PREF_CHANGELOG_LAST_SEEN, latest).apply();
            return true;
        }

        return false;
    }
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)
798594
def show_pypi_changelog(self):
        
        hours = self.options.show_pypi_changelog
        if not hours.isdigit():
            self.logger.error("Error: You must supply an integer.")
            return 1

        try:
            changelog = self.pypi.changelog(int(hours))
        except XMLRPCFault as err_msg:
            self.logger.error(err_msg)
            self.logger.error("ERROR: Couldn't retrieve changelog.")
            return 1

        last_pkg = ''
        for entry in changelog:
            pkg = entry[0]
            if pkg != last_pkg:
                print("%s %s\n\t%s" % (entry[0], entry[1], entry[3]))
                last_pkg = pkg
            else:
                print("\t%s" % entry[3])

        return 0
471556
def main_from_cli():
    
    args, others = get_cli()

    if args.version:
        print(__version__)
        exit(0)

    log_level = logging.WARNING - 10 * args.verbosity
    logging.basicConfig(level=log_level, format="%(module)s %(levelname)8s %(message)s")

    command_line_updates = parse_other_args(others)

    old, new, updates = main(
        set_to=args.set,
        set_patch_count=args.set_patch_count,
        lock=args.lock,
        release=args.release,
        bump=args.bump,
        file_triggers=args.file_triggers,
        config_path=args.config,
        **command_line_updates
    )
    _LOG.info("previously: %s", old)
    _LOG.info("currently:  %s", new)
    _LOG.debug("updates:\n%s", pprint.pformat(updates))
    print(
        updates.get(config._forward_aliases.get(Constants.VERSION_FIELD))
        or updates.get(config._forward_aliases.get(Constants.VERSION_STRICT_FIELD))
    )