1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include "StdAfx.h"
- #include "SVNProc.h"
- CSVNProc::CSVNProc(void)
- {
- }
- CSVNProc::~CSVNProc(void)
- {
- }
- void CSVNProc::SVNProcess(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion, SVNTYPE type)
- {
- TCHAR szCommand[MAX_PATH] = { 0 };
- if ( type == SVN_EXPORT ) {
- // 先删除要导出的路径;
- _stprintf_s(szCommand, _T("/c rd /s /q %s"), strSavePath.c_str());
- ShellExecute(NULL, _T("open"), _T("cmd"), szCommand, NULL, SW_HIDE);
- // 再执行导出;
- _stprintf_s(szCommand, _T("/c svn export -r %d %s %s &pause"), dwSVNVersion, strSVNAddress.c_str(), strSavePath.c_str());
- }
- else if ( type == SVN_CHECKOUT ) {
- // 先删除要导出的路径;
- _stprintf_s(szCommand, _T("/c rd /s /q %s"), strSavePath.c_str());
- ShellExecute(NULL, _T("open"), _T("cmd"), szCommand, NULL, SW_HIDE);
- // 再执行导出;
- _stprintf_s(szCommand, _T("/c svn checkout -r %d %s %s &pause"), dwSVNVersion, strSVNAddress.c_str(), strSavePath.c_str());
- }
- else if ( type == SVN_ROLLBACK ) {
- _stprintf_s(szCommand, _T("/c svn update -r %d %s &pause"), dwSVNVersion, strSavePath.c_str());
- }
- ShellExecute(NULL, _T("open"), _T("cmd"), szCommand, NULL, SW_SHOW);
- }
- void CSVNProc::Export(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion)
- {
- SVNProcess(strSVNAddress, strSavePath, dwSVNVersion, SVN_EXPORT);
- }
- void CSVNProc::Checkout(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion)
- {
- SVNProcess(strSVNAddress, strSavePath, dwSVNVersion, SVN_CHECKOUT);
- }
- void CSVNProc::Rollback(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion)
- {
- SVNProcess(strSVNAddress, strSavePath, dwSVNVersion, SVN_ROLLBACK);
- }
|