Ensure we are using the latest revision in the hg repository
3615
def update(self, branch='default'):
        '''
        
        '''
        log.debug('Updating hg repo from hg_pillar module (pull)')
        self.repo.pull()
        log.debug('Updating hg repo from hg_pillar module (update)')
        self.repo.update(branch, clean=True)
85025
def _check_version(version):
    """"""
    if version != pyphi.__version__:
        raise pyphi.exceptions.JSONVersionError(
            'Cannot load JSON from a different version of PyPhi. '
            'JSON version = {0}, current version = {1}.'.format(
                version, pyphi.__version__))
1046015
def ensure_lockfile(keep_outdated=False, pypi_mirror=None):
    """"""
    if not keep_outdated:
        keep_outdated = project.settings.get("keep_outdated")
    # Write out the lockfile if it doesn't exist, but not if the Pipfile is being ignored
    if project.lockfile_exists:
        old_hash = project.get_lockfile_hash()
        new_hash = project.calculate_pipfile_hash()
        if new_hash != old_hash:
            click.echo(
                crayons.red(
                    fix_utf8("Pipfile.lock ({0}) out of date, updating to ({1})…".format(
                        old_hash[-6:], new_hash[-6:]
                    )),
                    bold=True,
                ),
                err=True,
            )
            do_lock(keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
    else:
        do_lock(keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
33855
def update(self):
        """"""
        if not os.path.isdir(os.path.join(self.path)):
            os.makedirs(self.path)
        if not os.path.isdir(os.path.join(self.path, 'refs')):
            subprocess.check_output([
                'git', 'clone', '--bare', self.repo_git, self.path
            ])
        self.run(['gc', '--auto', '--prune=all'])
        self.run(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
        # github support
        self.run(['fetch', 'origin', '+refs/pull/*/head:refs/pull/*'])
        # gitlab support
        self.run([
            'fetch', 'origin', '+refs/merge-requests/*/head:refs/pull/*'])
1176447
def can_be_updated(cls, dist, latest_version):
        """"""
        scheme = get_scheme('default')
        name = dist.project_name
        dependants = cls.get_dependants(name)
        for dependant in dependants:
            requires = dependant.requires()
            for requirement in cls.get_requirement(name, requires):
                req = parse_requirement(requirement)
                # Ignore error if version in requirement spec can't be parsed
                try:
                    matcher = scheme.matcher(req.requirement)
                except UnsupportedVersionError:
                    continue
                if not matcher.match(str(latest_version)):
                    return False

        return True
483145
def status_mercurial(path, ignore_set, options):
    
    lines = run(['hg', '--config', 'extensions.color=!', 'st'], cwd=path)
    subrepos = ()
    return [b' ' + l for l in lines if not l.startswith(b'?')], subrepos
875310
def check_version_consistency(self):
        

        version = None
        releaser_name = None

        for releaser in self.releasers:
            try:
                next_version = releaser.determine_current_version()
            except NotImplementedError:
                continue

            if next_version and version and version != next_version:
                raise Exception('Inconsistent versions, {} is at {} but {} is at {}.'.format(
                                releaser_name, version, releaser.name, next_version))

            version = next_version
            releaser_name = releaser.name
100287
def get_previous_version(self):
        """"""
        gh = self.get_github_api()
        repo = gh.repository(self.repo_owner, self.repo_name)
        most_recent = None
        for release in repo.releases():
            # Return the second release that matches the release prefix
            if release.tag_name.startswith(self.project__git__prefix_release):
                if most_recent is None:
                    most_recent = release
                else:
                    return LooseVersion(self.get_version_for_tag(release.tag_name))
240968
def make_version(ref=None):
    """"""
    cmd = 'git describe --tags --abbrev=6 {}'.format(ref or '')
    with hide('commands'):
        version = local(cmd, capture=True).strip()
    if re.match('^v[0-9]', version):
        version = version[1:]
    # replacements to match semver.org build numbers
    if '-' in version:
        head, _, tail = version.partition('-')
        count, _, sha = tail.partition('-g')
        version = head + '+' + count + '-' + sha
    return version
896839
def didLastExecutedUpgradeSucceeded(self) -> bool:
        
        lastEventInfo = self.lastActionEventInfo
        if lastEventInfo:
            ev_data = lastEventInfo.data
            currentPkgVersion = NodeControlUtil.curr_pkg_info(ev_data.pkg_name)[0]
            if currentPkgVersion:
                return currentPkgVersion.upstream == ev_data.version
            else:
                logger.warning(
                    "{} failed to get information about package {} "
                    "scheduled for last upgrade"
                    .format(self, ev_data.pkg_name)
                )
        return False
921487
def version_control():
    """"""
    curdir_contents = os.listdir('.')
    if '.hg' in curdir_contents:
        return hg.Hg()
    elif '.git' in curdir_contents:
        return git.Git()
    else:
        logger.critical('No version control system detected.')
        sys.exit(1)
458897
def versions
      @versions ||=
        repo
        .tags
        .map(&:name)
        .select { |tag| tag =~ /(.*\..*\..*)/ }
        .map { |tag| Semverse::Version.try_new tag }
        .compact
    end
400643
def htmresearchCorePrereleaseInstalled():
  
  try:
    coreDistribution = pkg_resources.get_distribution("htmresearch-core")
    if pkg_resources.parse_version(coreDistribution.version).is_prerelease:
      # A pre-release dev version of htmresearch-core is installed.
      return True
  except pkg_resources.DistributionNotFound:
    pass  # Silently ignore.  The absence of htmresearch-core will be handled by
          # setuptools by default

  return False
726395
def has_new_revision(self):
        
        if self.history.current_revision is None:
            return self.state.revision_id is not None

        current_revision_id = self.history.current_revision.revision_id
        return self.state.revision_id != current_revision_id
370957
def run_outdated(cls, options):
        """"""
        latest_versions = sorted(
            cls.find_packages_latest_versions(cls.options),
            key=lambda p: p[0].project_name.lower())

        for dist, latest_version, typ in latest_versions:
            if latest_version > dist.parsed_version:
                if options.all:
                    pass
                elif options.pinned:
                    if cls.can_be_updated(dist, latest_version):
                        continue
                elif not options.pinned:
                    if not cls.can_be_updated(dist, latest_version):
                        continue
                    elif options.update:
                        print(dist.project_name if options.brief else
                              'Updating %s to Latest: %s [%s]' %
                              (cls.output_package(dist), latest_version, typ))
                        main(['install', '--upgrade'] + ([
                            '--user'
                        ] if ENABLE_USER_SITE else []) + [dist.key])
                        continue

                print(dist.project_name if options.brief else
                      '%s - Latest: %s [%s]' %
                      (cls.output_package(dist), latest_version, typ))
236867
protected void checkAntVersion(Hashtable h)
  {

    if (null == h)
      h = new Hashtable();

    try
    {
      final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
      final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
      final Class noArgs[] = new Class[0];

      Class clazz = ObjectFactory.findProviderClass(
        ANT_VERSION_CLASS, ObjectFactory.findClassLoader(), true);

      Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
      Object returnValue = method.invoke(null, new Object[0]);

      h.put(VERSION + "ant", (String)returnValue);
    }
    catch (Exception e)
    {
      h.put(VERSION + "ant", CLASS_NOTPRESENT);
    }
  }
395587
def _cmd_up(self):
        """"""
        revision = self._get_revision()
        if not self._rev:
            self._log(0, "upgrading current revision")
        else:
            self._log(0, "upgrading from revision %s" % revision)
        for rev in self._revisions[int(revision) - 1:]:
            sql_files = glob.glob(os.path.join(self._migration_path, rev, "*.up.sql"))
            sql_files.sort()
            self._exec(sql_files, rev)
        self._log(0, "done: upgraded revision to %s\n" % rev)