コード例 #1
0
ファイル: SyncDlg.cpp プロジェクト: Blonder/TortoiseGit
void CSyncDlg::RunPostAction()
{
	if (m_bWantToExit)
		return;

	FillNewRefMap();

	if (this->m_CurrentCmd == GIT_COMMAND_PUSH)
	{
		if (!m_GitCmdStatus)
		{
			CTGitPathList list;
			list.AddPath(CTGitPath(g_Git.m_CurrentDir));
			DWORD exitcode;
			CString error;
			if (CHooks::Instance().PostPush(list,exitcode, error))
			{
				if (exitcode)
				{
					CString temp;
					temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
					//ReportError(temp);
					CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
					return;
				}
			}

		}
		EnableControlButton(true);
		SwitchToInput();
		this->FetchOutList(true);
	}
	else if (this->m_CurrentCmd == GIT_COMMAND_PULL)
	{
		PullComplete();
	}
	else if (this->m_CurrentCmd == GIT_COMMAND_FETCH || this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE)
	{
		FetchComplete();
	}
	else if (this->m_CurrentCmd == GIT_COMMAND_SUBMODULE)
	{
		//this->m_ctrlCmdOut.SetSel(-1,-1);
		//this->m_ctrlCmdOut.ReplaceSel(_T("Done\r\n"));
		//this->m_ctrlCmdOut.SetSel(-1,-1);
		EnableControlButton(true);
		SwitchToInput();
	}
	else if (this->m_CurrentCmd == GIT_COMMAND_STASH)
	{
		StashComplete();
	}
	else if (this->m_CurrentCmd == GIT_COMMAND_REMOTE)
	{
		this->FetchOutList(true);
		EnableControlButton(true);
		SwitchToInput();
		ShowTab(IDC_REFLIST);
	}
}
コード例 #2
0
LRESULT CSyncDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam)
{
	if(wParam == MSG_PROGRESSDLG_START)
	{
		m_ctrlAnimate.Play(0,-1,-1);
		this->m_ctrlProgress.SetPos(0);
		if (m_pTaskbarList)
		{
			m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NORMAL);
			m_pTaskbarList->SetProgressValue(m_hWnd, 0, 100);
		}
	}

	if(wParam == MSG_PROGRESSDLG_END || wParam == MSG_PROGRESSDLG_FAILED)
	{
		//m_bDone = true;
		m_ctrlAnimate.Stop();
		m_ctrlProgress.SetPos(100);
		//this->DialogEnableWindow(IDOK,TRUE);
		if (m_pTaskbarList)
			m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NOPROGRESS);

		//if(wParam == MSG_PROGRESSDLG_END)
		if(this->m_CurrentCmd == GIT_COMMAND_PUSH )
		{
			if(!m_GitCmdStatus)
			{
				CTGitPathList list;
				list.AddPath(CTGitPath(g_Git.m_CurrentDir));
				DWORD exitcode;
				CString error;
				if (CHooks::Instance().PostPush(list,exitcode, error))
				{
					if (exitcode)
					{
						CString temp;
						temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
						//ReportError(temp);
						CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
						return false;
					}
				}

			}
			EnableControlButton(true);
			SwitchToInput();
			this->FetchOutList(true);
		}
		if(this->m_CurrentCmd == GIT_COMMAND_PULL )
		{
			PullComplete();
		}
		if(this->m_CurrentCmd == GIT_COMMAND_FETCH || this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE)
		{
			FetchComplete();
		}
		if(this->m_CurrentCmd == GIT_COMMAND_SUBMODULE)
		{
			//this->m_ctrlCmdOut.SetSel(-1,-1);
			//this->m_ctrlCmdOut.ReplaceSel(_T("Done\r\n"));
			//this->m_ctrlCmdOut.SetSel(-1,-1);
			EnableControlButton(true);
			SwitchToInput();
		}
		if(this->m_CurrentCmd == GIT_COMMAND_REMOTE)
		{
			this->FetchOutList(true);
			EnableControlButton(true);
			SwitchToInput();
		}
	}

	if(lParam != 0)
		ParserCmdOutput((char)lParam);

	return 0;
}