"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.svnCleanup = exports.svnRevert = exports.svnLog = exports.svnCommit = exports.svnUpdate = exports.isSvnWorkingCopy = exports.checkInstallSvn = void 0; const child_process_1 = require("child_process"); /**是否安装了svn */ function checkInstallSvn() { return new Promise(res => { (0, child_process_1.exec)('svn --version --quiet', (error, stdout, stderr) => { if (stdout) { res(true); } else { res(false); } }); }); } exports.checkInstallSvn = checkInstallSvn; /**是否是svn工作副本 */ function isSvnWorkingCopy() { return new Promise(res => { (0, child_process_1.exec)('svn info ' + Editor.Project.path, (error, stdout, stderr) => { if (stdout) { res(true); } else { res(false); } }); }); } exports.isSvnWorkingCopy = isSvnWorkingCopy; async function checkSvnEnvironment(succCall) { let cond1 = await checkInstallSvn(); let cond2 = await isSvnWorkingCopy(); if (!cond1) { return Editor.Dialog.error('未安装svn或svn未添加环境变量'); } if (!cond2) { return Editor.Dialog.error('当前项目不是svn工作副本'); } cond1 && cond2 && succCall(); } function svnUpdate(path = '') { console.log('svn更新路径:', path); checkSvnEnvironment(() => { (0, child_process_1.exec)('TortoiseProc.exe /command:update /path:' + path); }); } exports.svnUpdate = svnUpdate; function svnCommit(path = '') { console.log('svn提交路径:', path); checkSvnEnvironment(() => { (0, child_process_1.exec)('TortoiseProc.exe /command:commit /path:' + path); }); } exports.svnCommit = svnCommit; function svnLog(path = '') { console.log('svn日志路径:', path); checkSvnEnvironment(() => { (0, child_process_1.exec)('TortoiseProc.exe /command:log /path:' + path); }); } exports.svnLog = svnLog; function svnRevert(path = '') { console.log('svn还原路径:', path); checkSvnEnvironment(() => { (0, child_process_1.exec)('TortoiseProc.exe /command:revert /path:' + path); }); } exports.svnRevert = svnRevert; function svnCleanup(path = '') { console.log('svn清理路径:', path); checkSvnEnvironment(() => { (0, child_process_1.exec)('TortoiseProc.exe /command:cleanup /path:' + path); }); } exports.svnCleanup = svnCleanup;