|
module.exports = MoveSummary;
|
|
/**
|
* The MoveSummary is returned as a response to getting `git().status()`
|
*
|
* @constructor
|
*/
|
function MoveSummary () {
|
this.moves = [];
|
this.sources = {};
|
}
|
|
MoveSummary.SUMMARY_REGEX = /^Renaming (.+) to (.+)$/;
|
|
MoveSummary.parse = function (text) {
|
var lines = text.split('\n');
|
var summary = new MoveSummary();
|
|
for (var i = 0, iMax = lines.length, line; i < iMax; i++) {
|
line = MoveSummary.SUMMARY_REGEX.exec(lines[i].trim());
|
|
if (line) {
|
summary.moves.push({
|
from: line[1],
|
to: line[2]
|
});
|
}
|
}
|
|
return summary;
|
};
|