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

import org.mockito.release.exec.ProcessRunner;

import java.util.Date;
import java.util.regex.Pattern;

import static org.mockito.release.notes.internal.DateFormat.parseDate;

/**
 * Provides date of given vcs revision
 */
class RevisionDateProvider {

    private final ProcessRunner runner;
    /**
     * pattern for validating revision date in ISO format
     * Example of valid date: 2017-01-29 08:14:09 -0800
     */
    private final Pattern REVISION_DATE_PATTERN = Pattern.compile(
            "\\s?\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\s[-+]\\d{4}\\s?");

    RevisionDateProvider(ProcessRunner runner) {
        this.runner = runner;
    }

    public Date getDate(String rev) {
        String gitOutput = runner.run("git", "log", "--pretty=%ad", "--date=iso", rev, "-n", "1");
        if(!REVISION_DATE_PATTERN.matcher(gitOutput).matches()){
           throw new IllegalArgumentException("Can't get a proper date for revision number " + rev + ". Are you sure this revision or tag exists?");
        }

        return parseDate(gitOutput.trim());
    }
}<commit_msg>RevisionDateProvider error message improved #71<commit_after>package org.mockito.release.notes.vcs;

import org.mockito.release.exec.ProcessRunner;

import java.util.Date;
import java.util.regex.Pattern;

import static org.mockito.release.notes.internal.DateFormat.parseDate;

/**
 * Provides date of given vcs revision
 */
class RevisionDateProvider {

    private final ProcessRunner runner;
    /**
     * pattern for validating revision date in ISO format
     * Example of valid date: 2017-01-29 08:14:09 -0800
     */
    private final Pattern REVISION_DATE_PATTERN = Pattern.compile(
            "\\s?\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\s[-+]\\d{4}\\s?");

    RevisionDateProvider(ProcessRunner runner) {
        this.runner = runner;
    }

    public Date getDate(String rev) {
        String gitOutput = runner.run("git", "log", "--pretty=%ad", "--date=iso", rev, "-n", "1");
        if(!REVISION_DATE_PATTERN.matcher(gitOutput).matches()){
           throw new IllegalArgumentException(formatErrorMessage(rev, gitOutput));
        }

        return parseDate(gitOutput.trim());
    }

    private String formatErrorMessage(String rev, String gitOutput) {
        return "Can't get a proper date for revision number " + rev +
                ". Are you sure this revision or tag exists?" +
                " Following output was returned by git:\n" + gitOutput;
    }
}
{'fraction_non_alphanumeric': 0.14189456995640112, 'fraction_numerical': 0.02140309155766944, 'mean_word_length': 2.956112852664577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1220533', 'n_tokens_mistral': 803, 'n_tokens_neox': 752, 'n_words': 188}