@yuki-no/plugin-batch-pr
Version:
Batch PR plugin for yuki-no - Collects opened Yuki-no translation issues and creates a single pull request
21 lines (20 loc) • 1.09 kB
JavaScript
import { createFileChanges } from './createFileChanges';
import { parseFileStatuses } from './parseFileStatuses';
import { log } from '@yuki-no/plugin-sdk/utils/log';
export const extractFileChanges = (headGit, hash, fileNameFilter, rootDir) => {
log('I', `extractFileChanges :: Starting extraction for hash: ${hash}`);
const fileStatusString = headGit.exec(`show --name-status --format="" ${hash}`);
const fileStatuses = parseFileStatuses(fileStatusString, fileNameFilter);
log('I', `extractFileChanges :: Found ${fileStatuses.length} file statuses`);
if (fileStatuses.length === 0) {
log('I', 'extractFileChanges :: No file changes found, returning empty array');
return [];
}
log('I', `extractFileChanges :: Processing ${fileStatuses.length} file statuses`);
const fileChanges = [];
for (const fileStatus of fileStatuses) {
fileChanges.push(...createFileChanges(headGit, hash, fileStatus, rootDir));
}
log('S', `extractFileChanges :: Successfully extracted ${fileChanges.length} file changes`);
return fileChanges;
};