コード例 #1
0
ファイル: RefLogDlg.cpp プロジェクト: murank/TortoiseGitMod
void CRefLogDlg::OnCbnSelchangeRef()
{
	CString ref=m_ChooseRef.GetString();
	if(m_RefList.m_RefMap.find(ref) == m_RefList.m_RefMap.end())
	{
		m_RefList.m_RefMap[ref].m_pLogCache = &m_RefList.m_LogCache;
		m_RefList.m_RefMap[ref].ParserFromRefLog(ref);
	}
	m_RefList.ClearText();

	//this->m_logEntries.ParserFromLog();
	m_RefList.SetRedraw(false);

	CLogDataVector *plog;
	plog = &m_RefList.m_RefMap[ref];

	m_RefList.SetItemCountEx(plog->size());

	this->m_RefList.m_arShownList.RemoveAll();

	for(unsigned int i=0;i<m_RefList.m_RefMap[ref].size();i++)
	{
		plog->GetGitRevAt(i).m_IsFull=TRUE;
		this->m_RefList.m_arShownList.Add(&(plog->GetGitRevAt(i)));

	}

	m_RefList.SetRedraw(true);

	m_RefList.Invalidate();

}
コード例 #2
0
bool PrevDiffCommand::Execute()
{
	if (!GitAdminDir::HasAdminDir(g_Git.m_CurrentDir))
	{
		CMessageBox::Show(GetExplorerHWND(), IDS_NOWORKINGCOPY, IDS_APPNAME, MB_ICONERROR);
		return false;
	}

	bool bAlternativeTool = !!parser.HasKey(L"alternative");
	bool bUnified = !!parser.HasKey(L"unified");
	if (this->orgCmdLinePath.IsDirectory())
	{
		CFileDiffDlg dlg;
		theApp.m_pMainWnd = &dlg;
		dlg.m_strRev1 = L"HEAD~1";
		dlg.m_strRev2 = GIT_REV_ZERO;
		dlg.m_sFilter = this->cmdLinePath.GetGitPathString();

		dlg.DoModal();
		return true;
	}

	CLogDataVector revs;
	CLogCache cache;
	revs.m_pLogCache = &cache;
	revs.ParserFromLog(&cmdLinePath, 2, CGit::LOG_INFO_ONLY_HASH);

	if (revs.size() != 2)
	{
		CMessageBox::Show(GetExplorerHWND(), IDS_ERR_NOPREVREVISION, IDS_APPNAME, MB_ICONERROR);
		return false;
	}

	return !!CGitDiff::Diff(GetExplorerHWND(), &cmdLinePath, &cmdLinePath, GIT_REV_ZERO, revs.GetGitRevAt(1).m_CommitHash.ToString(), false, bUnified, 0, bAlternativeTool);
}
コード例 #3
0
bool PrevDiffCommand::Execute()
{
	bool bRet = false;
	//bool bAlternativeTool = !!parser.HasKey(_T("alternative"));
	if (this->orgCmdLinePath.IsDirectory())
	{
		CFileDiffDlg dlg;

		dlg.m_strRev1 = GIT_REV_ZERO;
		dlg.m_strRev2 = _T("HEAD~1");
		dlg.m_sFilter = this->cmdLinePath.GetGitPathString();

		//dlg.m_pathList = CTGitPathList(cmdLinePath);
		dlg.DoModal();
		bRet = true;
	}
	else
	{
		GitStatus st;
		st.GetStatus(cmdLinePath);

		if (1)
		{
			CString hash;
			CString logout;

			CLogDataVector revs;
			CLogCache cache;
			revs.m_pLogCache=&cache;

			revs.ParserFromLog(&cmdLinePath,2,CGit::LOG_INFO_ONLY_HASH);

			if( revs.size() != 2)
			{
				CMessageBox::Show(hWndExplorer, IDS_ERR_NOPREVREVISION, IDS_APPNAME, MB_ICONERROR);
				bRet = false;
			}
			else
			{
				CGitDiff diff;
				bRet = !!diff.Diff(&cmdLinePath,&cmdLinePath, GIT_REV_ZERO, revs.GetGitRevAt(1).m_CommitHash.ToString());
			}
		}
		else
		{
			//if (st.GetLastErrorMsg().IsEmpty())
			{
				CMessageBox::Show(hWndExplorer, IDS_ERR_NOPREVREVISION, IDS_APPNAME, MB_ICONERROR);
			}
			//else
			//{
			//	CMessageBox::Show(hWndExplorer, IDS_ERR_NOSTATUS, IDS_APPNAME, MB_ICONERROR);
			//s}
		}
	}
	return bRet;
}