Compute an new version and write it as a tag
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
926941
def tag():
    """"""
    if check_unstaged():
        raise EnvironmentError('There are staged changes, abort.')
    with open(str(INIT_PATH)) as f:
        metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", f.read()))
    version = metadata['version']
    check_output(['git', 'tag', version, '-m', 'Release v{}'.format(version)])
1323522
def get_tagged_version_numbers(series='stable'):
    """'"""
    releases = []
    if series == 'testing':
        # Testing releases always have a hyphen after the version number:
        tag_regex = re.compile('^refs/tags/cassandra-([0-9]+\.[0-9]+\.[0-9]+-.*$)')
    else:
        # Stable and oldstable releases are just a number:
        tag_regex = re.compile('^refs/tags/cassandra-([0-9]+\.[0-9]+\.[0-9]+$)')

    tag_url = urllib.request.urlopen(GITHUB_TAGS)
    for ref in (i.get('ref', '') for i in json.loads(tag_url.read())):
        m = tag_regex.match(ref)
        if m:
            releases.append(LooseVersion(m.groups()[0]))

    # Sort by semver:
    releases.sort(reverse=True)

    stable_major_version = LooseVersion(str(releases[0].version[0]) + "." + str(releases[0].version[1]))
    stable_releases = [r for r in releases if r >= stable_major_version]
    oldstable_releases = [r for r in releases if r not in stable_releases]
    oldstable_major_version = LooseVersion(str(oldstable_releases[0].version[0]) + "." + str(oldstable_releases[0].version[1]))
    oldstable_releases = [r for r in oldstable_releases if r >= oldstable_major_version]

    if series == 'testing':
        return [r.vstring for r in releases]
    elif series == 'stable':
        return [r.vstring for r in stable_releases]
    elif series == 'oldstable':
        return [r.vstring for r in oldstable_releases]
    else:
        raise AssertionError("unknown release series: {series}".format(series=series))
1091437
function updateVersion2gitTag(pkg) {
	let tag = child_process.execSync('git describe --tag').toString().trim();
	pkg.version = tag;
}
748713
def get_version(cls, path, memo={}):
        
        if path not in memo:
            memo[path] = subprocess.check_output(
                "git describe --tags --dirty 2> /dev/null",
                shell=True, cwd=path).strip().decode("utf-8")

            v = re.search("-[0-9]+-", memo[path])
            if v is not None:
                # Replace -n- with -branchname-n-
                branch = r"-{0}-\1-".format(cls.get_branch(path))
                (memo[path], _) = re.subn("-([0-9]+)-", branch, memo[path], 1)

        return memo[path]
1314469
def get_version(
    root=".",
    version_scheme="guess-next-dev",
    local_scheme="node-and-date",
    write_to=None,
    write_to_template=None,
    relative_to=None,
    tag_regex=None,
    fallback_version=None,
    parse=None,
    git_describe_command=None,
):
    

    config = Configuration()
    config.root = root
    config.version_scheme = version_scheme
    config.local_scheme = local_scheme
    config.write_to = write_to
    config.write_to_template = write_to_template
    config.relative_to = relative_to
    config.tag_regex = tag_regex
    config.fallback_version = fallback_version
    config.parse = parse
    config.git_describe_command = git_describe_command

    parsed_version = _do_parse(config)

    if parsed_version:
        version_string = format_version(
            parsed_version, version_scheme=version_scheme, local_scheme=local_scheme
        )
        dump_version(
            root=root,
            version=version_string,
            write_to=write_to,
            template=write_to_template,
        )

        return version_string
37597
function getVersionTags() {
	var tags = exec('git tag', { silent: true }).output.trim().split(/\n/g);

	return tags.reduce(function(list, tag) {
		if (semver.valid(tag)) {
			list.push(tag);
		}
		return list;
	}, []).sort(semver.compare);
}
247804
def _push_new_tag_to_git(self):
        
        print("Pushing new version to git")            

        ## stage the releasefile and initfileb
        subprocess.call(["git", "add", self.release_file])
        subprocess.call(["git", "add", self.init_file])
        subprocess.call([
            "git", "commit", "-m", "Updating {}/__init__.py to version {}"\
            .format(self.package, self.tag)])

        ## push changes to origin <tracked branch>
        subprocess.call(["git", "push", "origin", self.branch])

        ## create a new tag for the version number on deploy
        if self.deploy:
            subprocess.call([
                "git", "tag", "-a", self.tag,
                "-m", "Updating version to {}".format(self.tag),
                ])
            subprocess.call(["git", "push", "origin"])
61109
def version(verbose):
    """"""
    print(Fore.BLUE + '-=' * 15)
    print(Fore.YELLOW + 'Superset ' + Fore.CYAN + '{version}'.format(
        version=config.get('VERSION_STRING')))
    print(Fore.BLUE + '-=' * 15)
    if verbose:
        print('[DB] : ' + '{}'.format(db.engine))
    print(Style.RESET_ALL)
412364
async function run() {
  try {
    // Find last release: Get tags, filter out wrong tags and pre-releases, then take last one.
    const { stdout } = // get last filtered tag, sorted by version numbers in ascending order
      await exec(`git tag | grep '${tagFrom}' | grep -Ev '-' | sort -V | tail -1`);
    const prevTag = stdout.trim();
    const nextVersion = parseVersion(argv[releaseNameParam]);

    // Normalize the given "release-name" for the tile (strip out pre-release information).
    const nextVersionString = `v${nextVersion.major}.${nextVersion.sub}.${nextVersion.minor}`;

    // Read previous changelog to extend it (remove ending line feeds -> added back in later)
    const changelogContent = fs.readFileSync('CHANGELOG.md', { encoding: 'utf8' }).trimRight();

    const config = lernaConfiguration.load();

    // This causes the "Unreleased" title to be replaced by a version that links to a github diff.
    config.nextVersion = `[${
      nextVersionString
    }](https://github.com/shopgate/pwa/compare/${prevTag}...${nextVersionString})`;

    // Skip creation if the "nextVersion" title is already present.
    if (changelogContent.includes(config.nextVersion)) {
      // Output the already existing data when already is there already.
      logger.log(changelogContent);
      return;
    }

    const changelog = new Changelog(config);

    // The "release-name" param is not supposed to be used here. Instead use "HEAD".
    const latestChanges = await changelog.createMarkdown({
      tagFrom: prevTag,
      tagTo,
    });

    // Add changes to the top of the main changelog
    let newChangelog = '# Changelog\n';
    if (appendPreviousChangelog) {
      newChangelog = changelogContent;
    }
    if (latestChanges.trim().length > 0) {
      newChangelog = newChangelog.replace(
        '# Changelog\n',
        `# Changelog\n\n${latestChanges.trim()}\n`
      );
      if (tagTo !== 'HEAD') {
        newChangelog = newChangelog.replace(
          `## ${tagTo} `,
          `## ${config.nextVersion} `
        );
      }
    }

    // Print the output for the bash/makefile to read
    logger.log(newChangelog);
  } catch (error) {
    throw error;
  }
}
996880
def version_to_write(self, found):  # type: (str) -> Version
        
        first = False
        if self.version is None:
            first = True
            try:
                self.current_version, self.version, self.schema = version_object_and_next(
                    found.strip(" ")
                )
            except:
                raise JiggleVersionException("Shouldn't throw here.")

        if first:
            logger.info(
                "Updating from version {0} to {1}".format(
                    unicode(self.version), unicode(self.version)
                )
            )
        return self.version
1308808
def _write_new_tag_to_init(self):
        
        for line in fileinput.input(self.init_file, inplace=1):
            if line.strip().startswith("__version__"):
                line = "__version__ = \"" + self.tag + "\""
            print(line.strip("\n"))
739144
def iddversiontuple(afile):
    """"""
    def versiontuple(vers):
        """version tuple"""
        return tuple([int(num) for num in vers.split(".")])
    try:
        fhandle = open(afile, 'rb')
    except TypeError:
        fhandle = afile
    line1 = fhandle.readline()
    try:
        line1 = line1.decode('ISO-8859-2')
    except AttributeError:
        pass
    line = line1.strip()
    if line1 == '':
        return (0,)
    vers = line.split()[-1]
    return versiontuple(vers)
939606
def version(self):
        """"""

        versions = []
        versions.append("sosreport: %s" % __version__)

        for plugname, plug in self.loaded_plugins:
            versions.append("%s: %s" % (plugname, plug.version))

        self.archive.add_string(content="\n".join(versions),
                                dest='version.txt')
978006
def tags_to_versions(tags, config=None):
    
    result = []
    for tag in tags:
        tag = tag_to_version(tag, config=config)
        if tag:
            result.append(tag)
    return result
1099095
async def version(self, tp, params, version=None, elem=None):
        
        if self.writing:
            return await self.set_version(tp, params, version, elem)
        else:
            return await self.get_version(tp, params)
458897
def versions
      @versions ||=
        repo
        .tags
        .map(&:name)
        .select { |tag| tag =~ /(.*\..*\..*)/ }
        .map { |tag| Semverse::Version.try_new tag }
        .compact
    end