Find tag for git repository.
328838
def find_tag(match: str, strict: bool, directory: str):
    """"""
    with suppress(CalledProcessError):
        echo(git.find_tag(match, strict=strict, git_dir=directory))
1033571
def tag(name, path = Dir.pwd, opts = {})
      g = MiniGit.new(path)
      g.tag opts, name
    end
1138494
def __git_tag_push():
        
        command = ['git', 'push', 'origin', '--tags']
        Shell.msg('Pushing tags...')

        if APISettings.DEBUG:
            Git.__debug(command, True)

        if not call(command):
            return True
        return False
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])
459240
function createTag() {
  var newTagName = 'v1.0.0';

  return git.tag({tag: newTagName, message: newTagName + ' release', annotated: true})
      .then(git.push.bind(null, {tag: newTagName, remote: remote}));

}
1088848
def handle_tags(repo, **kwargs):
    """"""
    log.info('tags: %s %s' %(repo, kwargs))
    return [str(t) for t in repo.tags(**kwargs)]
517668
def tag(context, name, message=''):
    ""
    # If a tag was provided on the command-line, then add a Git tag and push it to origin
    if name:
        context.run('git tag -a {} -m {!r}'.format(name, message))
        context.run('git push origin {}'.format(name))
370717
def tag(self, tag: str, overwrite: bool = False) -> None:
        
        LOGGER.info('tagging repo: %s', tag)
        try:
            self.repo.create_tag(tag)
        except GitCommandError as exc:
            if 'already exists' in exc.stderr and overwrite:
                LOGGER.info('overwriting existing tag')
                self.remove_tag(tag)
                self.repo.create_tag(tag)
            else:
                LOGGER.exception('error while tagging repo')
                raise
644744
def _find_git_info(self, gitdir):
        
        res = {'remotes': None, 'tag': None, 'commit': None, 'dirty': None}
        try:
            logger.debug('opening %s as git.Repo', gitdir)
            repo = Repo(path=gitdir, search_parent_directories=False)
            res['commit'] = repo.head.commit.hexsha
            res['dirty'] = repo.is_dirty(untracked_files=True)
            res['remotes'] = {}
            for rmt in repo.remotes:
                # each is a git.Remote
                urls = [u for u in rmt.urls]  # generator
                if len(urls) > 0:
                    res['remotes'][rmt.name] = urls[0]
            for tag in repo.tags:
                # each is a git.Tag object
                if tag.commit.hexsha == res['commit']:
                    res['tag'] = tag.name
        except Exception:
            logger.debug('Exception getting git information', exc_info=True)
        return res
709579
def _get_tag(repo, name):
    '''
    
    '''
    try:
        return [x for x in _all_tags(repo) if x[0] == name][0]
    except IndexError:
        return False
1105550
function() {
    var highestTag = '0.0.0';
    var tags = exec('git tag');

    if (tags.code !== 0) return highestTag;

    tags = tags.output.split('\n');
    tags.forEach(function(tag) {
      tag = semver.valid(tag);
      if (tag && (!highestTag || semver.gt(tag, highestTag))) {
        highestTag = tag;
      }
    });

    return highestTag;
  }
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__
351145
async function getTagHead(tagName, execaOpts) {
  try {
    return await execa.stdout('git', ['rev-list', '-1', tagName], execaOpts);
  } catch (error) {
    debug(error);
  }
}
1170477
def find_branches(self):
        """"""
        for prefix, name, revision_id in self.find_branches_raw():
            yield Revision(
                branch=name,
                repository=self,
                revision_id=revision_id,
            )
1051581
def find_tags(self):
        """"""
        listing = self.context.capture('hg', 'tags')
        for line in listing.splitlines():
            tokens = line.split()
            if len(tokens) >= 2 and ':' in tokens[1]:
                revision_number, revision_id = tokens[1].split(':')
                yield Revision(
                    repository=self,
                    revision_id=revision_id,
                    revision_number=int(revision_number),
                    tag=tokens[0],
                )
380239
def git_tags() -> str:
    
    try:
        subprocess.check_call(['git', 'fetch', '--tags'])
    except CalledProcessError:
        pass

    cmd = ['git', 'tag', '--list', '--sort=-v:refname']
    rv = subprocess.check_output(cmd).decode('utf-8')

    if rv == '':
        raise NoGitTagsException('No Git tags are present in current repo.')

    return rv
99697
def git_tag_exists(tag, sha)
      exists = false
      sh_step("git tag -l #{tag}") do |_, output|
        exists = (output.strip == tag)
      end

      # If the tag does exist, make sure the existing SHA matches the SHA we're
      # trying to build from.
      if exists
        sh_step("git rev-list -n 1 #{tag}") do |_, output|
          raise "#{tag} already exists at a different SHA" \
            if output.strip != sha
        end

        log.info("tag #{tag} already exists")
      end

      exists
    end