simple-git
Version:
Simple GIT interface for node.js
36 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const MergeSummary_1 = require("../responses/MergeSummary");
const utils_1 = require("../utils");
const parse_pull_1 = require("./parse-pull");
const parsers = [
new utils_1.LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
summary.merges.push(autoMerge);
}),
new utils_1.LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file));
}),
new utils_1.LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file, { deleteRef }));
}),
new utils_1.LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, null));
}),
new utils_1.LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
summary.result = result;
}),
];
/**
* Parse the complete response from `git.merge`
*/
exports.parseMergeResult = (stdOut, stdErr) => {
return Object.assign(exports.parseMergeDetail(stdOut, stdErr), parse_pull_1.parsePullResult(stdOut, stdErr));
};
/**
* Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`
* @param stdOut
*/
exports.parseMergeDetail = (stdOut) => {
return utils_1.parseStringResponse(new MergeSummary_1.MergeSummaryDetail(), parsers, stdOut);
};
//# sourceMappingURL=parse-merge.js.map