Exemple #1
0
bool CHooks::PostPush(const CString& workingTree, DWORD& exitcode, CString& error)
{
	auto it = FindItem(post_push_hook, workingTree);
	if (it == end())
		return false;
	CString sCmd = it->second.commandline;
	AddErrorParam(sCmd, error);
	AddCWDParam(sCmd, workingTree);
	exitcode = RunScript(sCmd, workingTree, error, it->second.bWait, it->second.bShow);
	return true;
}
Exemple #2
0
bool CHooks::StartUpdate(const CTGitPathList& pathList, DWORD& exitcode, CString& error)
{
	hookiterator it = FindItem(start_update_hook, pathList);
	if (it == end())
		return false;
	CString sCmd = it->second.commandline;
	AddPathParam(sCmd, pathList);
	AddCWDParam(sCmd, pathList);
	exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow);
	return true;
}
Exemple #3
0
bool CHooks::PreUpdate(const CTGitPathList& pathList, git_depth_t depth, GitRev rev, DWORD& exitcode, CString& error)
{
	hookiterator it = FindItem(pre_update_hook, pathList);
	if (it == end())
		return false;
	CString sCmd = it->second.commandline;
	AddPathParam(sCmd, pathList);
	AddDepthParam(sCmd, depth);
	AddParam(sCmd, rev.m_CommitHash.ToString());
	AddCWDParam(sCmd, pathList);
	exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow);
	return true;
}
Exemple #4
0
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;
}
Exemple #5
0
bool CHooks::StartUpdate(HWND hWnd, const CTSVNPathList& pathList, DWORD& exitcode, CString& error)
{
    hookiterator it = FindItem(start_update_hook, pathList);
    if (it == end())
        return false;
    if (!ApproveHook(hWnd, it))
        return false;
    CString sCmd = it->second.commandline;
    AddPathParam(sCmd, pathList);
    AddCWDParam(sCmd, pathList);
    exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow);
    return true;
}
Exemple #6
0
bool CHooks::PreRebase(const CString& workingTree, const CString& upstream, const CString& rebasedBranch, DWORD& exitcode, CString& error)
{
	auto it = FindItem(pre_rebase_hook, workingTree);
	if (it == end())
		return false;
	CString sCmd = it->second.commandline;
	AddParam(sCmd, upstream);
	AddParam(sCmd, rebasedBranch);
	AddErrorParam(sCmd, error);
	AddCWDParam(sCmd, workingTree);
	exitcode = RunScript(sCmd, workingTree, error, it->second.bWait, it->second.bShow);
	return true;
}
Exemple #7
0
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;
}
Exemple #8
0
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;
}
Exemple #9
0
bool CHooks::PostCommit(const CString& workingTree, bool amend, DWORD& exitcode, CString& error)
{
	auto it = FindItem(post_commit_hook, workingTree);
	if (it == end())
		return false;
	CString sCmd = it->second.commandline;
	AddCWDParam(sCmd, workingTree);
	if (amend)
		AddParam(sCmd, L"true");
	else
		AddParam(sCmd, L"false");
	exitcode = RunScript(sCmd, workingTree, error, it->second.bWait, it->second.bShow);
	return true;
}
Exemple #10
0
bool CHooks::PreUpdate(HWND hWnd, const CTSVNPathList& pathList, svn_depth_t depth, const SVNRev& rev, DWORD& exitcode, CString& error)
{
    hookiterator it = FindItem(pre_update_hook, pathList);
    if (it == end())
        return false;
    if (!ApproveHook(hWnd, it))
        return false;
    CString sCmd = it->second.commandline;
    AddPathParam(sCmd, pathList);
    AddDepthParam(sCmd, depth);
    AddParam(sCmd, rev.ToString());
    AddCWDParam(sCmd, pathList);
    exitcode = RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow);
    return true;
}
Exemple #11
0
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;
}
Exemple #12
0
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;
}
Exemple #13
0
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;
}
Exemple #14
0
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;
}