<commit_before>package org.mockito.release.notes.vcs;

import org.mockito.release.notes.model.Commit;
import org.mockito.release.notes.model.ContributionSet;
import org.mockito.release.notes.util.Predicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.LinkedList;

class GitContributionsProvider implements ContributionsProvider {

    private static final Logger LOG = LoggerFactory.getLogger(GitContributionsProvider.class);
    private final GitLogProvider logProvider;
    private final Predicate<Commit> ignoredCommit;

    GitContributionsProvider(GitLogProvider logProvider, Predicate<Commit> commitApprover) {
        this.logProvider = logProvider;
        this.ignoredCommit = commitApprover;
    }

    public ContributionSet getContributionsBetween(String fromRev, String toRev) {
        LOG.info("Fetching {} from the repo", fromRev);

        Collection<Commit> commits = getCommits(fromRev, toRev);

        DefaultContributionSet contributions = new DefaultContributionSet();
        for (Commit commit : commits) {
            if (ignoredCommit.isTrue(commit)) {
                contributions.add(commit);
            }
        }
        return contributions;
    }

    private Collection<Commit> getCommits(String fromRev, String toRev) {
        LOG.info("Loading all commits between {} and {}", fromRev, toRev);

        LinkedList<Commit> commits = new LinkedList<Commit>();
        String commitToken = "@@commit@@";
        String infoToken = "@@info@@";
        // %H: commit hash<commit_msg>Renamed ignoredCommit field to commitApprover since its logic is inverted<commit_after>package org.mockito.release.notes.vcs;

import org.mockito.release.notes.model.Commit;
import org.mockito.release.notes.model.ContributionSet;
import org.mockito.release.notes.util.Predicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.LinkedList;

class GitContributionsProvider implements ContributionsProvider {

    private static final Logger LOG = LoggerFactory.getLogger(GitContributionsProvider.class);
    private final GitLogProvider logProvider;
    private final Predicate<Commit> commitApprover;

    GitContributionsProvider(GitLogProvider logProvider, Predicate<Commit> commitApprover) {
        this.logProvider = logProvider;
        this.commitApprover = commitApprover;
    }

    public ContributionSet getContributionsBetween(String fromRev, String toRev) {
        LOG.info("Fetching {} from the repo", fromRev);

        Collection<Commit> commits = getCommits(fromRev, toRev);

        DefaultContributionSet contributions = new DefaultContributionSet();
        for (Commit commit : commits) {
            if (commitApprover.isTrue(commit)) {
                contributions.add(commit);
            }
        }
        return contributions;
    }

    private Collection<Commit> getCommits(String fromRev, String toRev) {
        LOG.info("Loading all commits between {} and {}", fromRev, toRev);

        LinkedList<Commit> commits = new LinkedList<Commit>();
        String commitToken = "@<PASSWORD>@@";
        String infoToken = "@<PASSWORD>@@";
        // %H: commit hash
{'fraction_non_alphanumeric': 0.09364341085271317, 'fraction_numerical': 0.00124031007751938, 'mean_word_length': 3.661849710982659, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2499674', 'n_tokens_mistral': 889, 'n_tokens_neox': 866, 'n_words': 200}