本文整理汇总了C++中CFileDiffDlg::DoModal方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileDiffDlg::DoModal方法的具体用法?C++ CFileDiffDlg::DoModal怎么用?C++ CFileDiffDlg::DoModal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileDiffDlg
的用法示例。
在下文中一共展示了CFileDiffDlg::DoModal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
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);
}
示例2: OnBnClickedShowModifiedFiles
void CResetDlg::OnBnClickedShowModifiedFiles()
{
CFileDiffDlg dlg;
dlg.m_strRev1 = _T("0000000000000000000000000000000000000000");
dlg.m_strRev2 = _T("HEAD");
dlg.DoModal();
}
示例3: OnBnClickedShowModifiedFiles
void CMergeAbortDlg::OnBnClickedShowModifiedFiles()
{
CFileDiffDlg dlg;
dlg.m_strRev1 = L"HEAD";
dlg.m_strRev2 = GIT_REV_ZERO;
dlg.DoModal();
}
示例4: Execute
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;
}
示例5: DiffCommit
int CGitDiff::DiffCommit(CTGitPath &path, CString r1, CString r2)
{
if (path.GetWinPathString().IsEmpty())
{
CFileDiffDlg dlg;
dlg.SetDiff(NULL,r1,r2);
dlg.DoModal();
}
else if (path.IsDirectory())
{
CFileDiffDlg dlg;
dlg.SetDiff(&path,r1,r2);
dlg.DoModal();
}
else
{
Diff(&path,&path,r1,r2);
}
return 0;
}
示例6: DiffCommit
int CGitDiff::DiffCommit(const CTGitPath &path1, const CTGitPath &path2, const GitRev *r1, const GitRev *r2)
{
if (path1.GetWinPathString().IsEmpty())
{
CFileDiffDlg dlg;
dlg.SetDiff(NULL, *r1, *r2);
dlg.DoModal();
}
else if (path1.IsDirectory())
{
CFileDiffDlg dlg;
dlg.SetDiff(&path1, *r1, *r2);
dlg.DoModal();
}
else
{
Diff(&path1, &path2, r1->m_CommitHash.ToString(), r2->m_CommitHash.ToString());
}
return 0;
}
示例7: ShowContextMenu
//.........这里部分代码省略.........
temp.LoadString(IDS_MENUBRANCH);
popupMenu.AppendMenuIcon(eCmd_CreateBranch, temp, IDI_COPY);
}
if(pTree->IsFrom(L"refs/tags"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUTAG);
popupMenu.AppendMenuIcon(eCmd_CreateTag, temp, IDI_TAG);
temp.LoadString(IDS_PROC_BROWSEREFS_DELETEALLTAGS);
popupMenu.AppendMenuIcon(eCmd_DeleteAllTags, temp, IDI_DELETE);
if (!remotes.empty())
{
popupMenu.AppendMenu(MF_SEPARATOR);
int i = 0;
for (auto it = remotes.cbegin(); it != remotes.cend(); ++it, ++i)
{
temp.Format(IDS_DELETEREMOTETAGON, (LPCTSTR)*it);
popupMenu.AppendMenuIcon(eCmd_DeleteRemoteTag | (i << 16), temp, IDI_DELETE);
}
}
}
}
int selection = popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN | TPM_RETURNCMD, point.x, point.y, this, 0);
switch ((eCmd)(selection & 0xFFFF))
{
case eCmd_ViewLog:
{
CLogDlg dlg;
dlg.SetRange(g_Git.FixBranchName(selectedLeafs[0]->GetRefName()));
dlg.DoModal();
}
break;
case eCmd_ViewLogRange:
{
CLogDlg dlg;
dlg.SetRange(GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("..")));
dlg.DoModal();
}
break;
case eCmd_ViewLogRangeReachableFromOnlyOne:
{
CLogDlg dlg;
dlg.SetRange(GetTwoSelectedRefs(selectedLeafs, m_sLastSelected, _T("...")));
dlg.DoModal();
}
break;
case eCmd_RepoBrowser:
CAppUtils::RunTortoiseGitProc(_T("/command:repobrowser /path:\"") + g_Git.m_CurrentDir + _T("\" /rev:") + selectedLeafs[0]->GetRefName());
break;
case eCmd_DeleteBranch:
case eCmd_DeleteRemoteBranch:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs);
Refresh();
}
break;
case eCmd_DeleteTag:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs);
Refresh();
示例8: ShowCompare
bool SVNDiff::ShowCompare( const CTSVNPath& url1, const SVNRev& rev1, const CTSVNPath& url2, const SVNRev& rev2, SVNRev peg, bool ignoreprops, const CString& options, bool ignoreancestry /*= false*/, bool blame /*= false*/, svn_node_kind_t nodekind /*= svn_node_unknown*/ )
{
CTSVNPath tempfile;
CString mimetype;
CProgressDlg progDlg;
progDlg.SetTitle(IDS_APPNAME);
progDlg.SetTime(false);
m_pSVN->SetAndClearProgressInfo(&progDlg);
CAppUtils::DiffFlags diffFlags;
diffFlags.ReadOnly().AlternativeTool(m_bAlternativeTool);
if ((m_pSVN->PathIsURL(url1))||(!rev1.IsWorking())||(!url1.IsEquivalentTo(url2)))
{
// no working copy path!
progDlg.ShowModeless(GetHWND());
tempfile = CTempFiles::Instance().GetTempFilePath(false, url1);
// first find out if the url points to a file or dir
CString sRepoRoot;
if ((nodekind != svn_node_dir)&&(nodekind != svn_node_file))
{
progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROGRESS_INFO)));
SVNInfo info;
const SVNInfoData * data = info.GetFirstFileInfo(url1, (peg.IsValid() ? peg : m_headPeg), rev1, svn_depth_empty);
if (data == NULL)
{
data = info.GetFirstFileInfo(url1, (peg.IsValid() ? peg : rev1), rev1, svn_depth_empty);
if (data == NULL)
{
data = info.GetFirstFileInfo(url1, (peg.IsValid() ? peg : rev2), rev1, svn_depth_empty);
if (data == NULL)
{
progDlg.Stop();
m_pSVN->SetAndClearProgressInfo((HWND)NULL);
info.ShowErrorDialog(GetHWND());
return false;
}
else
{
sRepoRoot = data->reposRoot;
nodekind = data->kind;
peg = peg.IsValid() ? peg : rev2;
}
}
else
{
sRepoRoot = data->reposRoot;
nodekind = data->kind;
peg = peg.IsValid() ? peg : rev1;
}
}
else
{
sRepoRoot = data->reposRoot;
nodekind = data->kind;
peg = peg.IsValid() ? peg : m_headPeg;
}
}
else
{
sRepoRoot = m_pSVN->GetRepositoryRoot(url1);
peg = peg.IsValid() ? peg : m_headPeg;
}
if (nodekind == svn_node_dir)
{
if (rev1.IsWorking())
{
if (UnifiedDiff(tempfile, url1, rev1, url2, rev2, (peg.IsValid() ? peg : SVNRev::REV_WC), options))
{
CString sWC;
sWC.LoadString(IDS_DIFF_WORKINGCOPY);
progDlg.Stop();
m_pSVN->SetAndClearProgressInfo((HWND)NULL);
return !!CAppUtils::StartExtPatch(tempfile, url1.GetDirectory(), sWC, url2.GetSVNPathString(), TRUE);
}
}
else
{
progDlg.Stop();
m_pSVN->SetAndClearProgressInfo((HWND)NULL);
CFileDiffDlg fdlg;
fdlg.DoBlame(blame);
if (url1.IsEquivalentTo(url2))
{
fdlg.SetDiff(url1, (peg.IsValid() ? peg : m_headPeg), rev1, rev2, svn_depth_infinity, ignoreancestry);
fdlg.DoModal();
}
else
{
fdlg.SetDiff(url1, rev1, url2, rev2, svn_depth_infinity, ignoreancestry);
fdlg.DoModal();
}
}
}
else
{
if (url1.IsEquivalentTo(url2) && !ignoreprops)
{
svn_revnum_t baseRev = 0;
DiffProps(url1, rev2, rev1, baseRev);
//.........这里部分代码省略.........
示例9: Execute
bool SVNFetchCommand::Execute()
{
CString cmd, out, err;
cmd = _T("git.exe config svn-remote.svn.fetch");
if (!g_Git.Run(cmd, &out, &err, CP_UTF8))
{
int start = out.Find(_T(':'));
if( start >=0 )
out=out.Mid(start);
if(out.Left(5) == _T(":refs"))
out=out.Mid(6);
start = 0;
out=out.Tokenize(_T("\n"),start);
}
else
{
MessageBox(hwndExplorer, L"Found no SVN remote.", L"TortoiseGit", MB_OK | MB_ICONERROR);
return false;
}
CGitHash upstreamOldHash;
if (g_Git.GetHash(upstreamOldHash, out))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get upstream hash.")), _T("TortoiseGit"), MB_ICONERROR);
return false;
}
CProgressDlg progress;
progress.m_GitCmd=_T("git.exe svn fetch");
CGitHash upstreamNewHash; // declare outside lambda, because it is captured by reference
progress.m_PostCmdCallback = [&](DWORD status, PostCmdList& postCmdList)
{
if (status)
return;
if (g_Git.GetHash(upstreamNewHash, out))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get upstream hash after fetching.")), _T("TortoiseGit"), MB_ICONERROR);
return;
}
if (upstreamOldHash == upstreamNewHash)
return;
postCmdList.emplace_back(IDI_DIFF, _T("Fetched Diff"), [&]
{
CLogDlg dlg;
dlg.SetParams(CTGitPath(_T("")), CTGitPath(_T("")), _T(""), upstreamOldHash.ToString() + _T("..") + upstreamNewHash.ToString(), 0);
dlg.DoModal();
});
postCmdList.emplace_back(IDI_LOG, _T("Fetched Log"), [&]
{
CFileDiffDlg dlg;
dlg.SetDiff(nullptr, upstreamNewHash.ToString(), upstreamOldHash.ToString());
dlg.DoModal();
});
};
return progress.DoModal() == IDOK;
}
示例10: Execute
bool SVNFetchCommand::Execute()
{
CString cmd, out, err;
cmd = _T("git.exe config svn-remote.svn.fetch");
if (!g_Git.Run(cmd, &out, &err, CP_UTF8))
{
int start = out.Find(_T(':'));
if( start >=0 )
out=out.Mid(start);
if(out.Left(5) == _T(":refs"))
out=out.Mid(6);
start = 0;
out=out.Tokenize(_T("\n"),start);
}
else
{
CMessageBox::Show(NULL, _T("Found no SVN remote."), _T("TortoiseGit"), MB_OK|MB_ICONERROR);
return false;
}
CGitHash upstreamOldHash, upstreamNewHash;
if (g_Git.GetHash(upstreamOldHash, out))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get upstream hash.")), _T("TortoiseGit"), MB_ICONERROR);
return false;
}
CProgressDlg progress;
progress.m_GitCmd=_T("git.exe svn fetch");
progress.m_PostCmdList.Add(_T("Fetched Diff"));
progress.m_PostCmdList.Add(_T("Fetched Log"));
INT_PTR userResponse = progress.DoModal();
::DeleteFile(g_Git.m_CurrentDir + _T("\\sys$command"));
if (g_Git.GetHash(upstreamNewHash, out))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get upstream hash after fetching.")), _T("TortoiseGit"), MB_ICONERROR);
return false;
}
if (userResponse == IDC_PROGRESS_BUTTON1)
{
if (upstreamOldHash == upstreamNewHash)
{
if (progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"No new revisions fetched.", L"TortoiseGit Fetch", MB_OK | MB_ICONINFORMATION);
return true;
}
CLogDlg dlg;
dlg.SetParams(CTGitPath(_T("")), CTGitPath(_T("")), _T(""), upstreamOldHash.ToString() + _T("..") + upstreamNewHash.ToString(), 0);
dlg.DoModal();
return true;
}
else if (userResponse == IDC_PROGRESS_BUTTON1 + 1)
{
if (upstreamOldHash == upstreamNewHash)
{
if (progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"No new revisions fetched.", L"TortoiseGit Fetch", MB_OK | MB_ICONINFORMATION);
return true;
}
CFileDiffDlg dlg;
dlg.SetDiff(NULL, upstreamNewHash.ToString(), upstreamOldHash.ToString());
dlg.DoModal();
return true;
}
else
return false;
}
示例11: Execute
bool SVNFetchCommand::Execute()
{
bool autoClose = false;
if (parser.HasVal(_T("closeonend")))
autoClose = !!parser.GetLongVal(_T("closeonend"));
CString cmd, out, err;
cmd = _T("git.exe config svn-remote.svn.fetch");
if (!g_Git.Run(cmd, &out, &err, CP_UTF8))
{
int start = out.Find(_T(':'));
if( start >=0 )
out=out.Mid(start);
if(out.Left(5) == _T(":refs"))
out=out.Mid(6);
start = 0;
out=out.Tokenize(_T("\n"),start);
}
else
{
CMessageBox::Show(NULL, _T("Found no SVN remote."), _T("TortoiseGit"), MB_OK|MB_ICONERROR);
return false;
}
CString upstreamOldHash, upstreamNewHash;
upstreamOldHash = g_Git.GetHash(out);
CProgressDlg progress;
progress.m_GitCmd=_T("git.exe svn fetch");
progress.m_PostCmdList.Add(_T("Fetched Diff"));
progress.m_PostCmdList.Add(_T("Fetched Log"));
progress.m_bAutoCloseOnSuccess = autoClose;
int userResponse = progress.DoModal();
upstreamNewHash = g_Git.GetHash(out);
if (userResponse == IDC_PROGRESS_BUTTON1)
{
if (upstreamOldHash == upstreamNewHash)
{
if (progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"No new revisions fetched.", L"TortoiseGit Fetch", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
CLogDlg dlg;
dlg.SetParams(CTGitPath(_T("")), CTGitPath(_T("")), _T(""), upstreamOldHash, upstreamNewHash, 0);
dlg.DoModal();
return TRUE;
}
else if (userResponse == IDC_PROGRESS_BUTTON1 + 1)
{
if (upstreamOldHash == upstreamNewHash)
{
if (progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"No new revisions fetched.", L"TortoiseGit Fetch", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
CFileDiffDlg dlg;
dlg.SetDiff(NULL, upstreamNewHash, upstreamOldHash);
dlg.DoModal();
return TRUE;
}
else
return false;
return true;
}
示例12: Execute
bool PullCommand::Execute()
{
CPullFetchDlg dlg;
dlg.m_IsPull=TRUE;
if(dlg.DoModal()==IDOK)
{
CString url;
url=dlg.m_RemoteURL;
if(dlg.m_bAutoLoad)
{
CAppUtils::LaunchPAgent(NULL,&dlg.m_RemoteURL);
}
CString cmd;
CString hashOld = g_Git.GetHash(L"HEAD");
CString cmdRebase;
if(dlg.m_bRebase)
cmdRebase = "--rebase ";
CString noff;
CString ffonly;
CString squash;
CString nocommit;
if(dlg.m_bNoFF)
noff=_T("--no-ff");
if (dlg.m_bFFonly)
ffonly = _T("--ff-only");
if(dlg.m_bSquash)
squash=_T("--squash");
if(dlg.m_bNoCommit)
nocommit=_T("--no-commit");
int ver = CAppUtils::GetMsysgitVersion();
if(ver >= 0x01070203) //above 1.7.0.2
cmdRebase += _T("--progress ");
cmd.Format(_T("git.exe pull -v %s %s %s %s %s \"%s\" %s"), cmdRebase, noff, ffonly, squash, nocommit, url, dlg.m_RemoteBranchName);
CProgressDlg progress;
progress.m_GitCmd = cmd;
progress.m_PostCmdList.Add(_T("Pulled Diff"));
progress.m_PostCmdList.Add(_T("Pulled Log"));
CTGitPath gitPath = g_Git.m_CurrentDir;
if (gitPath.HasSubmodules())
progress.m_PostCmdList.Add(_T("Update submodules"));
//progress.m_PostCmdList.Add(_T("Show Conflict"));
if (parser.HasVal(_T("closeonend")))
progress.m_bAutoCloseOnSuccess = !!parser.GetLongVal(_T("closeonend"));
int ret = progress.DoModal();
CString hashNew = g_Git.GetHash(L"HEAD");
if( ret == IDC_PROGRESS_BUTTON1)
{
if(hashOld == hashNew)
{
if(progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"Already up to date.", L"Pull", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
CFileDiffDlg dlg;
dlg.SetDiff(NULL, hashNew, hashOld);
dlg.DoModal();
return TRUE;
}
else if ( ret == IDC_PROGRESS_BUTTON1 +1 )
{
if(hashOld == hashNew)
{
if(progress.m_GitStatus == 0)
CMessageBox::Show(NULL, L"Already up to date.", L"Pull", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
CLogDlg dlg;
//dlg.SetParams(cmdLinePath);
dlg.SetParams(CTGitPath(_T("")),CTGitPath(_T("")),_T(""), hashOld, hashNew, 0);
// dlg.SetIncludeMerge(!!parser.HasKey(_T("merge")));
// val = parser.GetVal(_T("propspath"));
// if (!val.IsEmpty())
// dlg.SetProjectPropertiesPath(CTSVNPath(val));
dlg.DoModal();
}
else if (ret == IDC_PROGRESS_BUTTON1 + 2 && gitPath.HasSubmodules())
{
CString sCmd;
//.........这里部分代码省略.........
示例13: ShowContextMenu
//.........这里部分代码省略.........
popupMenu.AppendMenuIcon(eCmd_Fetch, temp, IDI_PULL);
temp.LoadString(IDS_DELETEREMOTETAG);
popupMenu.AppendMenuIcon(eCmd_DeleteRemoteTag, temp, IDI_DELETE);
}
}
}
if(pTree->IsFrom(L"refs/heads"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUBRANCH);
popupMenu.AppendMenuIcon(eCmd_CreateBranch, temp, IDI_COPY);
}
if(pTree->IsFrom(L"refs/tags"))
{
if(bAddSeparator)
popupMenu.AppendMenu(MF_SEPARATOR);
CString temp;
temp.LoadString(IDS_MENUTAG);
popupMenu.AppendMenuIcon(eCmd_CreateTag, temp, IDI_TAG);
}
}
eCmd cmd=(eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);
switch(cmd)
{
case eCmd_ViewLog:
{
CLogDlg dlg;
dlg.SetStartRef(selectedLeafs[0]->GetRefName());
dlg.DoModal();
}
break;
case eCmd_RepoBrowser:
CAppUtils::RunTortoiseProc(_T("/command:repobrowser /path:\"") + g_Git.m_CurrentDir + _T("\" /rev:") + selectedLeafs[0]->GetRefName());
break;
case eCmd_DeleteBranch:
case eCmd_DeleteRemoteBranch:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs, true);
Refresh();
}
break;
case eCmd_DeleteTag:
{
if(ConfirmDeleteRef(selectedLeafs))
DoDeleteRefs(selectedLeafs, true);
Refresh();
}
break;
case eCmd_ShowReflog:
{
CRefLogDlg refLogDlg(this);
refLogDlg.m_CurrentBranch = selectedLeafs[0]->GetRefName();
refLogDlg.DoModal();
}
break;
case eCmd_Fetch:
{
CAppUtils::Fetch(remoteName);
Refresh();
}
示例14: Execute
bool PullCommand::Execute()
{
if (!GitAdminDir().HasAdminDir(g_Git.m_CurrentDir)) {
CMessageBox::Show(hwndExplorer, IDS_NOWORKINGCOPY, IDS_APPNAME, MB_ICONERROR);
return false;
}
CPullFetchDlg dlg;
dlg.m_IsPull=TRUE;
if(dlg.DoModal()==IDOK)
{
CString url;
url=dlg.m_RemoteURL;
if(dlg.m_bAutoLoad)
{
CAppUtils::LaunchPAgent(NULL,&dlg.m_RemoteURL);
}
CString cmd;
CGitHash hashOld;
if (g_Git.GetHash(hashOld, _T("HEAD")))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get HEAD hash.")), _T("TortoiseGit"), MB_ICONERROR);
return false;
}
CString cmdRebase;
if(dlg.m_bRebase)
cmdRebase = "--rebase ";
CString noff;
CString ffonly;
CString squash;
CString nocommit;
CString notags;
if (!dlg.m_bFetchTags)
notags = _T("--no-tags");
if(dlg.m_bNoFF)
noff=_T("--no-ff");
if (dlg.m_bFFonly)
ffonly = _T("--ff-only");
if(dlg.m_bSquash)
squash=_T("--squash");
if(dlg.m_bNoCommit)
nocommit=_T("--no-commit");
int ver = CAppUtils::GetMsysgitVersion();
if(ver >= 0x01070203) //above 1.7.0.2
cmdRebase += _T("--progress ");
cmd.Format(_T("git.exe pull -v %s %s %s %s %s %s \"%s\" %s"), cmdRebase, noff, ffonly, squash, nocommit, notags, url, dlg.m_RemoteBranchName);
CProgressDlg progress;
progress.m_GitCmd = cmd;
progress.m_PostCmdList.Add(CString(MAKEINTRESOURCE(IDS_PROC_PULL_DIFFS)));
progress.m_PostCmdList.Add(CString(MAKEINTRESOURCE(IDS_PROC_PULL_LOG)));
CTGitPath gitPath = g_Git.m_CurrentDir;
if (gitPath.HasSubmodules())
progress.m_PostCmdList.Add(CString(MAKEINTRESOURCE(IDS_PROC_SUBMODULESUPDATE)));
//progress.m_PostCmdList.Add(_T("Show Conflict"));
if (parser.HasVal(_T("closeonend")))
progress.m_bAutoCloseOnSuccess = !!parser.GetLongVal(_T("closeonend"));
INT_PTR ret = progress.DoModal();
if (ret == IDOK && progress.m_GitStatus == 1 && progress.m_LogText.Find(_T("CONFLICT")) >= 0 && CMessageBox::Show(NULL, IDS_SEECHANGES, IDS_APPNAME, MB_YESNO | MB_ICONINFORMATION) == IDYES)
{
CChangedDlg dlg;
dlg.m_pathList.AddPath(CTGitPath());
dlg.DoModal();
return FALSE;
}
CGitHash hashNew;
if (g_Git.GetHash(hashNew, L"HEAD"))
{
MessageBox(hwndExplorer, g_Git.GetGitLastErr(_T("Could not get HEAD hash after pulling.")), _T("TortoiseGit"), MB_ICONERROR);
return FALSE;
}
if( ret == IDC_PROGRESS_BUTTON1)
{
if(hashOld == hashNew)
{
if(progress.m_GitStatus == 0)
CMessageBox::Show(NULL, IDS_UPTODATE, IDS_APPNAME, MB_OK | MB_ICONINFORMATION);
return TRUE;
}
CFileDiffDlg dlg;
dlg.SetDiff(NULL, hashNew.ToString(), hashOld.ToString());
dlg.DoModal();
//.........这里部分代码省略.........
示例15: ContextMenuAction
void CGitBlameLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect,CMenu * menu)
{
POSITION pos = GetFirstSelectedItemPosition();
int indexNext = GetNextSelectedItem(pos);
if (indexNext < 0)
return;
CString procCmd;
GitRev* pSelLogEntry = reinterpret_cast<GitRev*>(m_arShownList.GetAt(indexNext));
bool bOpenWith = false;
procCmd += _T("/path:\"");
procCmd += ((CMainFrame*)::AfxGetApp()->GetMainWnd())->GetActiveView()->GetDocument()->GetPathName();
procCmd += _T("\" ");
procCmd += _T(" /rev:")+this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString();
procCmd += _T(" /command:");
switch (cmd)
{
case ID_GNUDIFF1:
procCmd += _T("diff /udiff");
break;
#if 0
case ID_GNUDIFF2:
{
CString tempfile=GetTempFile();
CString cmd;
GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));
GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));
cmd.Format(_T("git.exe diff-tree -r -p --stat %s %s"),r1->m_CommitHash,r2->m_CommitHash);
g_Git.RunLogFile(cmd,tempfile);
CAppUtils::StartUnifiedDiffViewer(tempfile, r1->m_CommitHash.Left(g_Git.GetShortHASHLength()) + _T(":") + r2->m_CommitHash.Left(g_Git.GetShortHASHLength()));
}
break;
#endif
#if 0
case ID_COMPARETWO:
{
GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));
GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));
CFileDiffDlg dlg;
dlg.SetDiff(NULL,*r1,*r2);
dlg.DoModal();
}
break;
#endif
#if 0
case ID_COMPARE:
{
GitRev * r1 = &m_wcRev;
GitRev * r2 = pSelLogEntry;
CFileDiffDlg dlg;
dlg.SetDiff(NULL,*r1,*r2);
dlg.DoModal();
//user clicked on the menu item "compare with working copy"
//if (PromptShown())
//{
// GitDiff diff(this, m_hWnd, true);
// diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));
// diff.SetHEADPeg(m_LogRevision);
// diff.ShowCompare(m_path, GitRev::REV_WC, m_path, revSelected);
//}
//else
// CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_WC, m_path, revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));
}
break;
case ID_COMPARE:
procCmd+=CString(_T("diff \rev1:"))+CString(GIT_REV_ZERO)+CString(_T(" \rev2:"))+this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString();
break;
#endif
case ID_COMPAREWITHPREVIOUS:
if (indexNext + 1 < m_logEntries.size()) // cannot diff previous revision in first revision
{
procCmd+=CString(_T("diff /startrev:"))+this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString()+CString(_T(" /endrev:"))+this->m_logEntries.GetGitRevAt(indexNext+1).m_CommitHash.ToString();
}
else
{
return;
}
break;
case ID_COPYCLIPBOARD:
{
CopySelectionToClipBoard();
}
return;
case ID_COPYHASH:
{
CopySelectionToClipBoard(TRUE);
}
return;
case ID_EXPORT:
procCmd += _T("export");
break;
//.........这里部分代码省略.........