Tag the repo with the current version that we're publishing
762234
function tagRepo(version) {
    if (SHOULD_PUBLISH) {
        shell.exec(`git tag ${version}`);
        shell.exec("git push origin --tags");
    } else {
        console.log(`\n\nWould publish git tag as version ${version}.`);
    }
}
499784
def validate_no_existing_tag(tag_string)
      existing_tags = []
      @gitrepo.tags.each { |tag| existing_tags << tag.name }
      if existing_tags.include?(tag_string)
        ui.error 'This version tag has already been committed to the repo.'
        ui.error "Are you sure you haven't released this already?"
        exit 6
      end
    end
1088848
def handle_tags(repo, **kwargs):
    """"""
    log.info('tags: %s %s' %(repo, kwargs))
    return [str(t) for t in repo.tags(**kwargs)]
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__
1240416
def validate_tag(self, tag_name, prefix=None):
        
        new_version = semantic_version(tag_name)
        current = self.latest()
        if current:
            tag_name = current['tag_name']
            if prefix:
                tag_name = tag_name[len(prefix):]
            tag_name = semantic_version(tag_name)
            if tag_name >= new_version:
                what = 'equal to' if tag_name == new_version else 'older than'
                raise GithubException(
                    'Your local version "%s" is %s '
                    'the current github version "%s".\n'
                    'Bump the local version to '
                    'continue.' %
                    (
                        str(new_version),
                        what,
                        str(tag_name)
                    )
                )
        return current
587003
def commit_new_version(version: str):
    

    check_repo()
    commit_message = config.get('semantic_release', 'commit_message')
    message = '{0}\n\n{1}'.format(version, commit_message)
    repo.git.add(config.get('semantic_release', 'version_variable').split(':')[0])
    return repo.git.commit(m=message, author="semantic-release <semantic-release>")
480696
def _update_repo(repo_config, store, tags_only):
    
    repo_path = store.clone(repo_config['repo'], repo_config['rev'])

    cmd_output('git', 'fetch', cwd=repo_path)
    tag_cmd = ('git', 'describe', 'origin/master', '--tags')
    if tags_only:
        tag_cmd += ('--abbrev=0',)
    else:
        tag_cmd += ('--exact',)
    try:
        rev = cmd_output(*tag_cmd, cwd=repo_path)[1].strip()
    except CalledProcessError:
        tag_cmd = ('git', 'rev-parse', 'origin/master')
        rev = cmd_output(*tag_cmd, cwd=repo_path)[1].strip()

    # Don't bother trying to update if our rev is the same
    if rev == repo_config['rev']:
        return repo_config

    try:
        path = store.clone(repo_config['repo'], rev)
        manifest = load_manifest(os.path.join(path, C.MANIFEST_FILE))
    except InvalidManifestError as e:
        raise RepositoryCannotBeUpdatedError(six.text_type(e))

    # See if any of our hooks were deleted with the new commits
    hooks = {hook['id'] for hook in repo_config['hooks']}
    hooks_missing = hooks - {hook['id'] for hook in manifest}
    if hooks_missing:
        raise RepositoryCannotBeUpdatedError(
            'Cannot update because the tip of master is missing these hooks:\n'
            '{}'.format(', '.join(sorted(hooks_missing))),
        )

    # Construct a new config with the head rev
    new_config = repo_config.copy()
    new_config['rev'] = rev
    return new_config
632448
def _get_last_tag(self):
        

        current_version = LooseVersion(
            self._get_version_from_tag(self.release_notes_generator.current_tag)
        )

        versions = []
        for tag in self.repo.tags():
            if not tag.name.startswith(self.github_info["prefix_prod"]):
                continue
            version = LooseVersion(self._get_version_from_tag(tag.name))
            if version >= current_version:
                continue
            versions.append(version)
        if versions:
            versions.sort()
            return "{}{}".format(self.github_info["prefix_prod"], versions[-1])
1124207
def sbo_version(self, repo, find):
        
        ver = ""
        if repo == "sbo":
            ver = "-" + SBoGrep(find).version()
        return ver
204877
def title(self):
        """"""
        if self.event:
            if self.release['name']:
                return u'{0}: {1}'.format(
                    self.repository['full_name'], self.release['name']
                )
        return u'{0} {1}'.format(self.repo_model.name, self.model.tag)
515219
def run(self):
        """"""
        sha = VersionUtils.run_git_command(["rev-parse", "HEAD"], self.git_dir)
        tag = self.distribution.get_version()

        if self.has_tag(tag, sha):
            tags_sha = VersionUtils.run_git_command(["rev-parse", tag], self.git_dir)
            if sha != tags_sha:
                logger.error(
                    "git tag {0} sha does not match the sha requesting to be tagged, you need to increment the version number, Skipped Tagging!".format(
                        tag
                    )
                )
                return
            else:
                logger.info(
                    "git tag {0} already exists for this repo, Skipped Tagging!".format(
                        tag
                    )
                )
                return

        logger.info("Adding tag {0} for commit {1}".format(tag, sha))
        if not self.dry_run:
            VersionUtils.run_git_command(
                ["tag", "-m", '""', tag, sha], self.git_dir, throw_on_error=True
            )
            logger.info("Pushing tag {0} to remote {1}".format(tag, self.remote))
            VersionUtils.run_git_command(
                ["push", self.remote, tag], self.git_dir, throw_on_error=True
            )
884469
def get_current_version(self, increment=None):
		
		ver = (
			self.get_tagged_version()
			or str(self.get_next_version(increment)) + '.dev0'
		)
		return str(ver)
410605
def validatetag(context):
    ""
    # Validate that a Git tag exists for the current commit HEAD
    result = context.run("git describe --exact-match --tags $(git log -n1 --pretty='%h')")
    tag = result.stdout.rstrip()

    # Validate that the Git tag appears to be a valid version number
    ver_regex = re.compile('(\d+)\.(\d+)\.(\d+)')
    match = ver_regex.fullmatch(tag)
    if match is None:
        print('Tag {!r} does not appear to be a valid version number'.format(tag))
        sys.exit(-1)
    else:
        print('Tag {!r} appears to be a valid version number'.format(tag))
859338
def _add_current_quay_tag(repo, container_tags):
    
    if ':' in repo:
        return repo, container_tags
    try:
        latest_tag = container_tags[repo]
    except KeyError:
        repo_id = repo[repo.find('/') + 1:]
        tags = requests.request("GET", "https://quay.io/api/v1/repository/" + repo_id).json()["tags"]
        latest_tag = None
        latest_modified = None
        for tag, info in tags.items():
            if latest_tag:
                if (dateutil.parser.parse(info['last_modified']) > dateutil.parser.parse(latest_modified)
                      and tag != 'latest'):
                    latest_modified = info['last_modified']
                    latest_tag = tag
            else:
                latest_modified = info['last_modified']
                latest_tag = tag
        container_tags[repo] = str(latest_tag)
    latest_pull = repo + ':' + str(latest_tag)
    return latest_pull, container_tags
479896
def tag_versions(repo_path):
    
    repo = dulwich.repo.Repo(repo_path)
    tags = get_tags(repo)
    maj_version = 0
    feat_version = 0
    fix_version = 0
    last_maj_version = 0
    last_feat_version = 0
    result = []

    for commit_sha, children in reversed(
            get_children_per_first_parent(repo_path).items()
    ):
        commit = get_repo_object(repo, commit_sha)
        maj_version, feat_version, fix_version = get_version(
            commit=commit,
            tags=tags,
            maj_version=maj_version,
            feat_version=feat_version,
            fix_version=fix_version,
            children=children,
        )
        if (
            last_maj_version != maj_version or
            last_feat_version != feat_version
        ):
            last_maj_version = maj_version
            last_feat_version = feat_version
            tag_name = 'refs/tags/v%d.%d' % (maj_version, feat_version)
            if ON_PYTHON3:
                repo[str.encode(tag_name)] = commit
            else:
                repo[tag_name] = commit

            result.append(
                'v%d.%d -> %s' % (maj_version, feat_version, commit_sha)
            )

    return '\n'.join(result)
761752
def show_version_info(self, version):
        

        if version in self.versions:
            stdout = self.repo.show(version, '--summary').stdout
            logger.info(stdout)
        else:
            logger.info('Version {0} not found'.format(version))
544826
def git_push():
    

    # get current version
    new_version = version.__version__
    values = list(map(lambda x: int(x), new_version.split('.')))

    # Push to origin new version and corresponding tag:
    # * commit new version
    # * create tag
    # * push version,tag to origin
    local('git add pynb/version.py version.py')

    local('git commit -m "updated version"')
    local('git tag {}.{}.{}'.format(values[0], values[1], values[2]))
    local('git push origin --tags')
    local('git push')