Parses the given commit log
    :param name: str, package name
    :param content: list, directory paths
    :param releases: list, releases
    :param get_head_fn: function
    :return: dict, changelog
436098
def parse_commit_log(name, content, releases, get_head_fn):
    
    log = ""
    raw_log = ""
    for path, _ in content:
        log += "\n".join(changelog(repository=GitRepos(path), tag_filter_regexp=r"v?\d+\.\d+(\.\d+)?"))
        raw_log += "\n" + subprocess.check_output(
            ["git", "-C", path, "--no-pager", "log", "--decorate"]).decode("utf-8")
        shutil.rmtree(path)
    log = parse(name, log, releases, get_head_fn)

    return log, raw_log
999862
def _iter_log_inner(debug):
    
    if debug:
        print('Generating ChangeLog')

    changelog = run('git log --oneline --decorate', hide=True).stdout.strip().decode('utf-8', 'replace')
    for line in changelog.split('\n'):
        line_parts = line.split()
        if len(line_parts) < 2:
            continue
        # Tags are in a list contained in ()'s. If a commit
        # subject that is tagged happens to have ()'s in it
        # this will fail
        if line_parts[1].startswith('(') and ')' in line:
            msg = line.split(')')[1].strip()
        else:
            msg = ' '.join(line_parts[1:])

        if 'tag:' in line:
            tags = set([
                tag.split(',')[0]
                for tag in line.split(')')[0].split('tag: ')[1:]])
        else:
            tags = set()

        yield line_parts[0], tags, msg
1284702
def _commitData(self, commit):
		
		return {
			"hexsha": commit.hexsha,
			"adate": commit.authored_date,
			"cdate": commit.committed_date,
			"author": "%s <%s>" % (commit.author.name, commit.author.email),
			"message": commit.message
		}
219762
def get_commits_since(check_name, target_tag=None):
    
    root = get_root()
    target_path = os.path.join(root, check_name)
    command = 'git log --pretty=%s {}{}'.format('' if target_tag is None else '{}... '.format(target_tag), target_path)

    with chdir(root):
        return run_command(command, capture=True).stdout.splitlines()
275949
def parse_changes():
    

    with open('CHANGES') as changes:
        for match in re.finditer(RE_CHANGES, changes.read(1024), re.M):
            if len(match.group(1)) != len(match.group(3)):
                error('incorrect underline in CHANGES')

            date = datetime.datetime.strptime(match.group(4),
                                              '%Y-%m-%d').date()

            if date != datetime.date.today():
                error('release date is not today')

            return match.group(2)

    error('invalid release entry in CHANGES')
233227
def _versions_from_changelog(changelog):
    
    versions = [Version(x) for x in changelog if BUGFIX_RELEASE_RE.match(x)]
    return sorted(versions)
824159
function parseProducerInfo(name, content) {
  const info = utils.splitString(content, ',', 5);
  const ret = {
    name,
    startedAt: Number(info[0]),
    msgTotal: Number(info[1]),
    msgSuccess: Number(info[2]),
    msgError: Number(info[3]),
    msgExpired: Number(info[4]),
  };
  return ret;
}
663500
def get_changelog_types(pr_payload):
    
    changelog_labels = []
    for name in get_pr_labels(pr_payload):
        if name.startswith(CHANGELOG_LABEL_PREFIX):
            # only add the name, e.g. for `changelog/Added` it's just `Added`
            changelog_labels.append(name.split(CHANGELOG_LABEL_PREFIX)[1])

    return changelog_labels
846959
def _parse_version(self, line):
        
        version_string = line.split(' ')[1]
        version_list = version_string.split('.')
        major_version = ''.join([version_list[0], version_list[1]])
        release_num = ''.join([version_list[2].rstrip(), "-03"])
        return (major_version, release_num)
190525
def get_head(self) -> Commit:
        
        head_commit = self.repo.head.commit
        return Commit(head_commit, self.path, self.main_branch)
1346230
def commit_history(filename):
    
    result = []
    repo = Repo()
    for commit in repo.head.commit.iter_parents(paths=_delta_dir() + filename):
        result.append({'date':
                       datetime.fromtimestamp(commit.committed_date +
                                              commit.committer_tz_offset),
                       'hexsha': commit.hexsha})
    return result
282529
def get_file_head(file_name):
    """"""

    text = None
    try:
        with open(file_name, 'r', encoding='utf-8') as fh:
            text = fh.read(512000)
    except:
        try:
            with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh:
                text = fh.read(512000)  # pragma: nocover
        except:
            log.traceback(logging.DEBUG)
    return text
1329077
def get_release_notes(osa_repo_dir, osa_old_commit, osa_new_commit):
    """"""
    repo = Repo(osa_repo_dir)

    # Get a list of tags, sorted
    tags = repo.git.tag().split('\n')
    tags = sorted(tags, key=LooseVersion)
    # Currently major tags are being printed after rc and
    # b tags. We need to fix the list so that major
    # tags are printed before rc and b releases
    tags = _fix_tags_list(tags)

    # Find the closest tag from a given SHA
    # The tag found here is the tag that was cut
    # either on or before the given SHA
    checkout(repo, osa_old_commit)
    old_tag = repo.git.describe()

    # If the SHA given is between two release tags, then
    # 'git describe' will return a tag in form of
    # <tag>-<commitNum>-<sha>. For example:
    # 14.0.2-3-g6931e26
    # Since reno does not support this format, we need to
    # strip away the commit number and sha bits.
    if '-' in old_tag:
        old_tag = old_tag[0:old_tag.index('-')]

    # Get the nearest tag associated with the new commit
    checkout(repo, osa_new_commit)
    new_tag = repo.git.describe()
    if '-' in new_tag:
        nearest_new_tag = new_tag[0:new_tag.index('-')]
    else:
        nearest_new_tag = new_tag

    # Truncate the tags list to only include versions
    # between old_sha and new_sha. The latest release
    # is not included in this list. That version will be
    # printed separately in the following step.
    tags = tags[tags.index(old_tag):tags.index(nearest_new_tag)]

    release_notes = ""
    # Checkout the new commit, then run reno to get the latest
    # releasenotes that have been created or updated between
    # the latest release and this new commit.
    repo.git.checkout(osa_new_commit, '-f')
    reno_report_command = ['reno',
                           'report',
                           '--earliest-version',
                           nearest_new_tag]
    reno_report_p = subprocess.Popen(reno_report_command,
                                     cwd=osa_repo_dir,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE)
    reno_output = reno_report_p.communicate()[0].decode('UTF-8')
    release_notes += reno_output

    # We want to start with the latest packaged release first, so
    # the tags list is reversed
    for version in reversed(tags):
        # If version is an rc or b tag, and it has a major
        # release tag, then skip it. There is no need to print
        # release notes for an rc or b release unless we are
        # comparing shas between two rc or b releases.
        repo.git.checkout(version, '-f')
        # We are outputing one version at a time here
        reno_report_command = ['reno',
                               'report',
                               '--branch',
                               version,
                               '--earliest-version',
                               version]
        reno_report_p = subprocess.Popen(reno_report_command,
                                         cwd=osa_repo_dir,
                                         stdout=subprocess.PIPE,
                                         stderr=subprocess.PIPE)
        reno_output = reno_report_p.communicate()[0].decode('UTF-8')
        # We need to ensure the output includes the version we are concerned
        # about.
        # This is due to https://bugs.launchpad.net/reno/+bug/1670173
        if version in reno_output:
            release_notes += reno_output

    # Clean up "Release Notes" title. We don't need this title for
    # each tagged release.
    release_notes = release_notes.replace(
        "=============\nRelease Notes\n=============",
        ""
    )
    # Replace headers that contain '=' with '~' to comply with osa-differ's
    # formatting
    release_notes = re.sub('===+', _equal_to_tilde, release_notes)
    # Replace headers that contain '-' with '#' to comply with osa-differ's
    # formatting
    release_notes = re.sub('---+', _dash_to_num, release_notes)
    return release_notes
491963
def get_changelog_date_packager(self):
        
        try:
            packager = subprocess.Popen(
                'rpmdev-packager', stdout=subprocess.PIPE).communicate(
                )[0].strip()
        except OSError:
            # Hi John Doe, you should install rpmdevtools
            packager = "John Doe <john@doe.com>"
            logger.warn("Package rpmdevtools is missing, using default "
                        "name: {0}.".format(packager))
        with utils.c_time_locale():
            date_str = time.strftime('%a %b %d %Y', time.gmtime())
        encoding = locale.getpreferredencoding()
        return u'{0} {1}'.format(date_str, packager.decode(encoding))
1092460
def parse_commit_log(commit_log: dict) -> str:
    
    rv = 'pat'

    cc_patterns = patterns()

    for value in commit_log.values():
        if re.search(cc_patterns['feat'], value):
            rv = 'min'
        if re.search(cc_patterns['BREAKING CHANGE'], value):
            rv = 'maj'

    return rv
1178596
def get_commit_log(from_rev=None):
    

    check_repo()
    rev = None
    if from_rev:
        rev = '...{from_rev}'.format(from_rev=from_rev)
    for commit in repo.iter_commits(rev):
        yield (commit.hexsha, commit.message)
1142969
def get_content(session, urls):
    

    content = ""
    for url in urls:
        try:
            logger.debug("GET changelog from {url}".format(url=url))
            if "https://api.github.com" in url and url.endswith("releases"):
                # this is a github API release page, fetch it if token is set
                if not GITHUB_API_TOKEN:
                    logger.warning("Fetching release pages requires CHANGELOGS_GITHUB_API_TOKEN "
                                   "to be set")
                    continue
                resp = session.get(url, headers={
                    "Authorization": "token {}".format(GITHUB_API_TOKEN)
                })
                if resp.status_code == 200:
                    for item in resp.json():
                        content += "\n\n{}\n{}".format(item['tag_name'], item["body"])
            else:
                resp = session.get(url)
                if resp.status_code == 200:
                    content += "\n\n" + resp.text
        except requests.ConnectionError:
            pass
    return content