bool CHooks::PreCommit(const CTGitPathList& pathList, git_depth_t depth, const CString& message, DWORD& exitcode, CString& error) { hookiterator it = FindItem(pre_commit_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddDepthParam(sCmd, depth); AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::PostCommit(const CString& workingTree, const CTGitPathList& pathList, const GitRev& rev, const CString& message, DWORD& exitcode, CString& error) { auto it = FindItem(post_commit_hook, workingTree); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddMessageFileParam(sCmd, message); AddParam(sCmd, rev.m_CommitHash.ToString()); AddErrorParam(sCmd, error); AddCWDParam(sCmd, workingTree); exitcode = RunScript(sCmd, workingTree, error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::PreCommit(const CString& workingTree, const CTGitPathList& pathList, CString& message, DWORD& exitcode, CString& error) { auto it = FindItem(pre_commit_hook, workingTree); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); CTGitPath temppath = AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, workingTree); exitcode = RunScript(sCmd, workingTree, error, it->second.bWait, it->second.bShow); if (!exitcode && !temppath.IsEmpty()) CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message); return true; }
bool CHooks::StartCommit(const CTGitPathList& pathList, CString& message, DWORD& exitcode, CString& error) { hookiterator it = FindItem(start_commit_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); CTGitPath temppath = AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); if (!exitcode && !temppath.IsEmpty()) { CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message); } return true; }
bool CHooks::PostLock(HWND hWnd, const CTSVNPathList & pathList, bool lock, bool steal, const CString & message, DWORD & exitcode, CString & error) { hookiterator it = FindItem(post_lock_hook, pathList); if (it == end()) return false; if (!ApproveHook(hWnd, it)) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddParam(sCmd, lock ? L"true" : L"false"); AddParam(sCmd, steal ? L"true" : L"false"); AddMessageFileParam(sCmd, message); AddErrorParam(sCmd, error); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::PostCommit(HWND hWnd, const CTSVNPathList& pathList, svn_depth_t depth, const SVNRev& rev, const CString& message, DWORD& exitcode, CString& error) { hookiterator it = FindItem(post_commit_hook, pathList); if (it == end()) return false; if (!ApproveHook(hWnd, it)) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddDepthParam(sCmd, depth); AddMessageFileParam(sCmd, message); AddParam(sCmd, rev.ToString()); AddErrorParam(sCmd, error); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::ManualPreCommit( HWND hWnd, const CTSVNPathList& pathList, CString& message, DWORD& exitcode, CString& error ) { hookiterator it = FindItem(manual_precommit, pathList); if (it == end()) return false; if (!ApproveHook(hWnd, it)) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); CTSVNPath temppath = AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow); if (!exitcode && !temppath.IsEmpty()) { CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message); } return true; }
bool CHooks::CheckCommit(HWND hWnd, const CTSVNPathList& pathList, CString& message, DWORD& exitcode, CString& error) { exitcode = 0; hookiterator it = FindItem(check_commit_hook, pathList); if (it == end()) return false; if (!ApproveHook(hWnd, it)) { exitcode = 1; error.LoadString(IDS_ERR_HOOKNOTAPPROVED); return false; } CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); CTSVNPath temppath = AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow); if (!exitcode && !temppath.IsEmpty()) { CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message); } return true; }