parameters: ()
return_statement: return None
docstring: Checks the current HEAD to see if it has been tagged with a tag that matches
      the pattern for a release tag.  Returns release version calculated from the
      tag, or None if there is no matching tag associated with HEAD.  If there are
      multiple release tags associated with HEAD, the one with the highest version
      is returned.
docstring_summary: Checks the current HEAD to see if it has been tagged with a tag that matches
      the pattern for a release tag.  Returns release version calculated from the
      tag, or None if there is no matching tag associated with HEAD.  If there are
      multiple release tags associated with HEAD, the one with the highest version
      is returned.
docstring_tokens: Checks the current HEAD to see if it has been tagged with a tag that matches the pattern for a release tag . Returns release version calculated from the tag or None if there is no matching tag associated with HEAD . If there are multiple release tags associated with HEAD the one with the highest version is returned .
function: def check_head_tag():
      """
      Checks the current HEAD to see if it has been tagged with a tag that matches
      the pattern for a release tag.  Returns release version calculated from the
      tag, or None if there is no matching tag associated with HEAD.  If there are
      multiple release tags associated with HEAD, the one with the highest version
      is returned.
      """
  
      found_tag = False
      version_loose = LooseVersion('0.0.0')
  
      tags = check_output(['git', 'tag', '-l']).split()
      head_commit = check_output(['git', 'rev-parse', '--revs-only',
                                             'HEAD^{commit}']).strip()
      for tag in tags:
          release_tag_match = RELEASE_TAG_RE.match(tag)
          tag_commit = check_output(['git', 'rev-parse', '--revs-only',
                                                tag + '^{commit}']).strip()
          if tag_commit == head_commit and release_tag_match:
              new_version_loose = LooseVersion(release_tag_match.group('ver'))
              if new_version_loose > version_loose:
                  if DEBUG:
                      print('HEAD release tag: ' + release_tag_match.group('ver'))
                  version_loose = new_version_loose
                  found_tag = True
  
      if found_tag:
          if DEBUG:
              print('Calculated version: ' + str(version_loose))
          return str(version_loose)
  
      return None
function_tokens: def check_head_tag ( ) : found_tag = False version_loose = LooseVersion ( '0.0.0' ) tags = check_output ( [ 'git' , 'tag' , '-l' ] ) . split ( ) head_commit = check_output ( [ 'git' , 'rev-parse' , '--revs-only' , 'HEAD^{commit}' ] ) . strip ( ) for tag in tags : release_tag_match = RELEASE_TAG_RE . match ( tag ) tag_commit = check_output ( [ 'git' , 'rev-parse' , '--revs-only' , tag + '^{commit}' ] ) . strip ( ) if tag_commit == head_commit and release_tag_match : new_version_loose = LooseVersion ( release_tag_match . group ( 'ver' ) ) if new_version_loose > version_loose : if DEBUG : print ( 'HEAD release tag: ' + release_tag_match . group ( 'ver' ) ) version_loose = new_version_loose found_tag = True if found_tag : if DEBUG : print ( 'Calculated version: ' + str ( version_loose ) ) return str ( version_loose ) return None