コード例 #1
0
ファイル: Hooks.cpp プロジェクト: murank/TortoiseGitMod
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;
}
コード例 #2
0
ファイル: Hooks.cpp プロジェクト: 545546460/TortoiseGit
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;
}
コード例 #3
0
ファイル: Hooks.cpp プロジェクト: 545546460/TortoiseGit
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;
}
コード例 #4
0
ファイル: Hooks.cpp プロジェクト: murank/TortoiseGitMod
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;
}
コード例 #5
0
ファイル: Hooks.cpp プロジェクト: YueLinHo/TortoiseSvn
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;
}
コード例 #6
0
ファイル: Hooks.cpp プロジェクト: YueLinHo/TortoiseSvn
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;
}
コード例 #7
0
ファイル: Hooks.cpp プロジェクト: YueLinHo/TortoiseSvn
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;
}
コード例 #8
0
ファイル: Hooks.cpp プロジェクト: YueLinHo/TortoiseSvn
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;
}