Will tag the currently active git commit id with the next release tag id
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
            )
1012981
function gitTag () {
      // If the tag exists, skip tagging
      if (shelljs.exec('git ls-remote --tags --exit-code ' + remoteName + ' ' + options.tag, {silent: true}).code === 0) {
        log.subhead('The tag "' + options.tag + '" already exists on remote. Skipping tagging.');
        return;
      }

      log.subhead('Tagging the local repository with ' + options.tag);
      execWrap('git tag ' + options.tag);
    }
933214
def git_list_tags(repo_dir, with_messages=False):
    """"""
    command = ['git', 'tag', '-l']
    if with_messages:
        command.append('-n1')
    raw = execute_git_command(command, repo_dir=repo_dir).splitlines()
    output = [l.strip() for l in raw if l.strip()]
    if with_messages:
        output = [tuple(j.strip() for j in line.split(None, 1))
                  for line in output]
    return output
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
770871
function gitHubRelease() {
			rbot.log.info('Releasing ' + commit.versionTag + ' via ' + options.gitHostname);
			// GitHub Release API will not remove the tag when removing a
			// release
			github.releaseAndUploadAsset(distAssets, coopt.regexLines, commit, tmpltData.name, chgLogRtn
					|| commit.message, options, rollCall, rollbackTag, function() {
				rollCall.then(publish);
			});
		}
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)])
518533
def has_commit(self):
        
        current_revision = self.history.current_revision
        revision_id = self.state.revision_id

        return current_revision.revision_id != revision_id
268983
function gitRelease() {
			// Tag release
			rbot.log.info('Tagging release ' + commit.versionTag + ' via ' + options.gitHostname);
			cmd('git tag -f -a ' + commit.versionTag + ' -m "'
					+ (chgLogRtn ? chgLogRtn.replace(coopt.regexLines, '$1 \\') : commit.message) + '"');
			cmd('git push -f ' + options.repoName + ' ' + commit.versionTag);
			commit.releaseId = commit.versionTag;
			// TODO : upload asset?
			rollCall.addRollback(rollbackTag);
			rollCall.then(publish);
		}
1300819
def replace_version_tag(self):
        """"""
        version_tag = self.arguments.get('<version>')
        special_keywords = ['current', 'latest']
        if version_tag in special_keywords:
            logger.error("releasing version '{}' is disallowed. Did you mean 'version upload'?".format(version_tag))
            raise SystemExit(1)
        placeholders = dict(major=0, minor=1, trivial=2)
        placeholder = placeholders.get(version_tag)
        if placeholder is None:
            return version_tag
        current_version = self.get_git_describe().lstrip('v')
        version_numbers = current_version.split('-')[0].split('.')
        version_numbers = [int(item) for item in version_numbers]
        version_numbers = version_numbers[:placeholder + 1]
        while len(version_numbers) < 3:
            version_numbers.append(0)
        version_numbers[placeholder] += 1
        return '.'.join([str(item) for item in version_numbers[:2 if placeholder < 2 else 3]])
82368
def have_active_commit(self):
        

        commit_state = sfs.file_or_default(sfs.cpjoin(self.base_path, 'active_commit'), None)
        if commit_state != None: return True
        return False
1067326
def tag_patches_branch(package, local_patches_branch, patches_branch,
                       force=False, push=False):
    
    vr = specfile.Spec().get_vr(epoch=False)
    nvr_tag = package + '-' + vr
    tag_cmd = ['tag', nvr_tag, local_patches_branch]
    if force:
        tag_cmd.append('-f')
    git(*tag_cmd)
    if push:
        patches_remote = patches_branch.partition('/')[0]
        git('push', patches_remote, nvr_tag)
    else:
        print('Not pushing tag. Run "git push patches %s" by hand.' % nvr_tag)
43414
def tagversion(repo, level='patch', special=''):
    
    prepend = 'v'
    with lcd(repo):
        oldversion = local(
            'git describe --abbrev=0 --tags', capture=True).strip()
        if oldversion.startswith('v'):
            oldversion = oldversion[1:]
        else:
            prepend = ''
    major, minor, patch = [int(x) for x in re.split('\D', oldversion, 3)[:3]]
    if special:
        if not re.match('^[a-z]', special):
            raise ValueError('Special must start with a-z')
        if not re.match('[_a-zA-Z0-9]+', special):
            raise ValueError('Must contain start with lowercase letter')
    if level == 'major':
        major, minor, patch = major + 1, 0, 0
    elif level == 'minor':
        major, minor, patch = major, minor + 1, 0
    elif level == 'patch':
        major, minor, patch = major, minor, patch + 1
    version_string = '{}.{}.{}'.format(major, minor, patch) + special
    with lcd(repo):
        local('git tag -s --force {}{}'.format(prepend, version_string))
    return version_string
1105554
def do_update_tag
      # query latest count=1 log entry for latest revision; don't attempt to
      # specify revision on the assumption that the requested revision is
      # already checked out. the --revision argument appears to expect a
      # revision from-to range or else a start date or date range or else a
      # specific revision number. it prints nothing when HEAD is specified by
      # itself.
      @repository = @repository.clone
      svn_args = ['log', '--limit', '1']
      svn_client.output_for(svn_args).lines.each do |line|
        if matched = SVN_LOG_REGEX.match(line)
          @repository.tag = matched[1]
          break
        end
      end
    end
166615
def _has_tag(version, debug=False):
    
    cmd = sh.git.bake('show-ref', '--verify', '--quiet',
                      "refs/tags/{}".format(version))
    try:
        util.run_command(cmd, debug=debug)
        return True
    except sh.ErrorReturnCode:
        return False
466744
function getCurrentTagNameCached(opts, data, reload){
    if( reload || !data.currentTagName ) {
      // Get new tags from the remote
      var result = exec(opts, 'git fetch --tags', {always: true});
      // #3: check if we have any tags
      result = exec(opts, 'git tag --list', {always: true});

      if( result.stdout.trim() === '' ) {
        data.currentTagName = "v0.0.0";
        grunt.log.warn('Repository does not have any tags: assuming "' + data.currentTagName + '"');
      } else {
        // Get the latest tag name
        result = exec(opts, 'git rev-list --tags --max-count=1', {always: true});
        result = exec(opts, 'git describe --tags ' + result.stdout.trim(), {always: true});
        result = result.stdout.trim();
        // data.currentTagName = semver.valid(result);
        data.currentTagName = result;
      }
    }
    return data.currentTagName;
  }
584457
def get_git_version(path):
    """"""
    branch_name = get_git_cleaned_branch_name(path)
    # Determine whether working copy is dirty (i.e. contains modified files)
    mods = run_cmd(path, 'git', 'status', '--porcelain', '--untracked-files=no')
    dirty = '.dirty' if mods else ''
    # Get a list of all commits on branch, with corresponding branch/tag refs
    # Each line looks something like: "d3e4d42 (HEAD, master, tag: v0.1)"
    git_output = run_cmd(path, 'git', 'log', '--pretty="%h%d"')
    commits = git_output.strip().replace('"', '').split('\n')
    num_commits_since_branch = len(commits)
    # Short hash of the latest commit
    short_commit_name = commits[0].partition(' ')[0]
    # A valid version is sequence of dotted numbers optionally prefixed by 'v'
    valid_version = re.compile(r'^v?([\.\d]+)$')

    def tagged_version(commit):
        """First tag on commit that is valid version, as a list of numbers."""
        refs = commit.partition(' ')[2]
        for ref in refs.lstrip('(').rstrip(')').split(', '):
            if ref.startswith('tag: '):
                tag = ref[5:].lower()
                found = valid_version.match(tag)
                if found:
                    return [int(v) for v in found.group(1).split('.') if v]
        return []
    # Walk back along branch and find first valid tagged version (or use 0.0)
    for commit in commits:
        version_numbers = tagged_version(commit)
        if version_numbers:
            break
    else:
        version_numbers = [0, 0]
    # It is a release if current commit has a version tag (and dir is clean)
    release = (commit == commits[0]) and not dirty
    if not release:
        # We are working towards the next (minor) release according to PEP 440
        version_numbers[-1] += 1
    version = '.'.join([str(v) for v in version_numbers])
    if not release:
        # Development version contains extra embellishments
        version = ("%s.dev%d+%s.%s%s" % (version, num_commits_since_branch,
                                         branch_name, short_commit_name, dirty))
    return version
1004076
def _has_commit(version, debug=False):
    
    if _has_tag(version, debug) or _has_branch(version, debug):
        return False
    cmd = sh.git.bake('cat-file', '-e', version)
    try:
        util.run_command(cmd, debug=debug)
        return True
    except sh.ErrorReturnCode:
        return False