本文整理汇总了C++中CSysProgressDlg类的典型用法代码示例。如果您正苦于以下问题:C++ CSysProgressDlg类的具体用法?C++ CSysProgressDlg怎么用?C++ CSysProgressDlg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSysProgressDlg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PatchAll
void CFilePatchesDlg::PatchAll()
{
if (m_pCallBack)
{
CSysProgressDlg progDlg;
progDlg.SetTitle(IDR_MAINFRAME);
progDlg.SetShowProgressBar(true);
progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_ALL)));
progDlg.ShowModeless(m_hWnd);
for (int i=0; i<m_arFileStates.GetCount() && !progDlg.HasUserCancelled(); i++)
{
if (m_arFileStates.GetAt(i) == FPDLG_FILESTATE_ERROR)
MessageBox(m_pPatch->GetPatchRejects(i), NULL, MB_ICONERROR);
else if (m_arFileStates.GetAt(i) != FPDLG_FILESTATE_PATCHED)
{
progDlg.SetLine(2, GetFullPath(i), true);
m_pCallBack->PatchFile(m_pPatch->GetStrippedPath(i), m_pPatch->GetContentMods(i), m_pPatch->GetPropMods(i), _T(""), TRUE);
m_ShownIndex = i;
m_cFileList.Invalidate();
}
progDlg.SetProgress64(i, m_arFileStates.GetCount());
}
progDlg.Stop();
}
}
示例2: PatchSelected
void CFilePatchesDlg::PatchSelected()
{
if (m_pCallBack)
{
CSysProgressDlg progDlg;
progDlg.SetTitle(IDR_MAINFRAME);
progDlg.SetShowProgressBar(true);
progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_SELECTED)));
progDlg.ShowModeless(m_hWnd);
// The list cannot be sorted by user, so the order of the
// items in the list is identical to the order in the array
// m_arFileStates.
int selCount = m_cFileList.GetSelectedCount();
int count = 1;
POSITION pos = m_cFileList.GetFirstSelectedItemPosition();
int index;
while (((index = m_cFileList.GetNextSelectedItem(pos)) >= 0) && (!progDlg.HasUserCancelled()))
{
if (m_arFileStates.GetAt(index) == FPDLG_FILESTATE_ERROR)
MessageBox(m_pPatch->GetPatchRejects(index), NULL, MB_ICONERROR);
else if (m_arFileStates.GetAt(index) != FPDLG_FILESTATE_PATCHED)
{
progDlg.SetLine(2, GetFullPath(index), true);
m_pCallBack->PatchFile(m_pPatch->GetStrippedPath(index), m_pPatch->GetContentMods(index), m_pPatch->GetPropMods(index), _T(""), TRUE);
m_ShownIndex = index;
m_cFileList.Invalidate();
}
progDlg.SetProgress64(count++, selCount);
}
progDlg.Stop();
}
}
示例3: PatchSelected
void CFilePatchesDlg::PatchSelected()
{
if (m_pCallBack)
{
CSysProgressDlg progDlg;
progDlg.SetTitle(IDR_MAINFRAME);
progDlg.SetShowProgressBar(true);
progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_SELECTED)));
progDlg.ShowModeless(m_hWnd);
// The list cannot be sorted by user, so the order of the
// items in the list is identical to the order in the array
// m_arFileStates.
int selCount = m_cFileList.GetSelectedCount();
int count = 1;
POSITION pos = m_cFileList.GetFirstSelectedItemPosition();
int index;
BOOL ret = TRUE;
while (((index = m_cFileList.GetNextSelectedItem(pos)) >= 0) && (!progDlg.HasUserCancelled()) && ret == TRUE)
{
if (m_arFileStates.GetAt(index)!= FPDLG_FILESTATE_PATCHED)
{
progDlg.SetLine(2, m_pPatch->GetFullPath(m_sPath, index), true);
ret = m_pCallBack->PatchFile(index, true, false);
}
progDlg.SetProgress64(count++, selCount);
}
progDlg.Stop();
}
}
示例4: Execute
bool RebaseCommand::Execute()
{
bool bRet =false;
if(!g_Git.CheckCleanWorkTree())
{
if (CMessageBox::Show(NULL, IDS_ERROR_NOCLEAN_STASH, IDS_APPNAME, 1, IDI_QUESTION, IDS_STASHBUTTON, IDS_ABORTBUTTON) == 1)
{
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROC_STASHRUNNING)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.SetCancelMsg(IDS_PROGRS_INFOFAILED);
sysProgressDlg.ShowModeless((HWND)NULL, true);
CString cmd,out;
cmd=_T("git.exe stash");
if (g_Git.Run(cmd, &out, CP_UTF8))
{
sysProgressDlg.Stop();
CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK);
return false;
}
sysProgressDlg.Stop();
}
else
{
return false;
}
}
while(1)
{
CRebaseDlg dlg;
dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_MENULOG)));
dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_PROC_RESTARTREBASE)));
INT_PTR ret = dlg.DoModal();
if( ret == IDOK)
{
bRet=true;
return bRet;
}
if( ret == IDCANCEL)
{
bRet=false;
return bRet;
}
if (ret == IDC_REBASE_POST_BUTTON)
{
CString cmd = _T("/command:log");
cmd += _T(" /path:\"") + g_Git.m_CurrentDir + _T("\"");
CAppUtils::RunTortoiseProc(cmd);
return true;
}
}
return bRet;
}
示例5: Refresh
void CDeleteRemoteTagDlg::Refresh()
{
m_ctrlTags.DeleteAllItems();
m_SelectAll.SetCheck(BST_UNCHECKED);
m_taglist.clear();
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_LOADING)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.ShowModal(this, true);
if (g_Git.GetRemoteTags(m_sRemote, m_taglist))
{
sysProgressDlg.Stop();
MessageBox(g_Git.GetGitLastErr(L"Could not retrieve remote tags.", CGit::GIT_CMD_FETCH), L"TortoiseGit", MB_ICONERROR);
}
sysProgressDlg.Stop();
BringWindowToTop();
for (int i = 0; i < (int)m_taglist.size(); ++i)
m_ctrlTags.InsertItem(i, m_taglist[i]);
DialogEnableWindow(IDOK, FALSE);
}
示例6: GetSelectedCount
void CDeleteRemoteTagDlg::OnBnClickedOk()
{
if (m_ctrlTags.GetSelectedCount() > 1)
{
CString msg;
msg.Format(IDS_PROC_DELETENREFS, m_ctrlTags.GetSelectedCount());
if (CMessageBox::Show(m_hWnd, msg, _T("TortoiseGit"), 2, IDI_QUESTION, CString(MAKEINTRESOURCE(IDS_DELETEBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 2)
return;
}
else // GetSelectedCount() is 1, otherwise the button is disabled
{
POSITION pos = m_ctrlTags.GetFirstSelectedItemPosition();
CString msg;
msg.Format(IDS_PROC_DELETEBRANCHTAG, (LPCTSTR)m_taglist[(m_ctrlTags.GetNextSelectedItem(pos))]);
if (CMessageBox::Show(m_hWnd, msg, _T("TortoiseGit"), 2, IDI_QUESTION, CString(MAKEINTRESOURCE(IDS_DELETEBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 2)
return;
}
STRING_VECTOR list;
POSITION pos = m_ctrlTags.GetFirstSelectedItemPosition();
int index;
while ((index = m_ctrlTags.GetNextSelectedItem(pos)) >= 0)
list.push_back(_T("refs/tags/") + m_taglist[index]);
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_DELETING_REMOTE_REFS)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.ShowModal(this, true);
if (g_Git.DeleteRemoteRefs(m_sRemote, list))
CMessageBox::Show(m_hWnd, g_Git.GetGitLastErr(_T("Could not delete remote ref."), CGit::GIT_CMD_PUSH), _T("TortoiseGit"), MB_OK | MB_ICONERROR);
sysProgressDlg.Stop();
BringWindowToTop();
Refresh();
}
示例7: DoDeleteRef
bool CBrowseRefsDlg::DoDeleteRef(CString completeRefName)
{
bool bIsRemoteBranch = false;
bool bIsBranch = false;
if (wcsncmp(completeRefName, L"refs/remotes/",13) == 0) {bIsBranch = true; bIsRemoteBranch = true;}
else if (wcsncmp(completeRefName, L"refs/heads/",11) == 0) {bIsBranch = true;}
if (bIsRemoteBranch)
{
CString branchToDelete = completeRefName.Mid(13);
CString remoteName, remoteBranchToDelete;
if (SplitRemoteBranchName(branchToDelete, remoteName, remoteBranchToDelete))
return false;
if (CAppUtils::IsSSHPutty())
CAppUtils::LaunchPAgent(NULL, &remoteName);
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_DELETING_REMOTE_REFS)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.ShowModal(this, true);
STRING_VECTOR list;
list.push_back(_T("refs/heads/") + remoteBranchToDelete);
if (g_Git.DeleteRemoteRefs(remoteName, list))
{
CMessageBox::Show(m_hWnd, g_Git.GetGitLastErr(_T("Could not delete remote ref."), CGit::GIT_CMD_PUSH), _T("TortoiseGit"), MB_OK | MB_ICONERROR);
sysProgressDlg.Stop();
BringWindowToTop();
return false;
}
sysProgressDlg.Stop();
BringWindowToTop();
}
else if (bIsBranch)
{
if (g_Git.DeleteRef(completeRefName))
{
CMessageBox::Show(m_hWnd, g_Git.GetGitLastErr(L"Could not delete reference.", CGit::GIT_CMD_DELETETAGBRANCH), _T("TortoiseGit"), MB_OK | MB_ICONERROR);
return false;
}
}
else if (wcsncmp(completeRefName, L"refs/tags/", 10) == 0)
{
if (g_Git.DeleteRef(completeRefName))
{
CMessageBox::Show(m_hWnd, g_Git.GetGitLastErr(L"Could not delete reference.", CGit::GIT_CMD_DELETETAGBRANCH), _T("TortoiseGit"), MB_OK | MB_ICONERROR);
return false;
}
}
return true;
}
示例8: GetFilesToCleanUp
static bool GetFilesToCleanUp(CTGitPathList& delList, const CString& baseCmd, CGit *pGit, const CString& path, const boolean quotepath, CSysProgressDlg& sysProgressDlg)
{
CString cmd(baseCmd);
if (!path.IsEmpty())
cmd += _T(" -- \"") + path + _T("\"");
CString cmdout, cmdouterr;
if (pGit->Run(cmd, &cmdout, &cmdouterr, CP_UTF8))
{
MessageBox(nullptr, cmdouterr, _T("TortoiseGit"), MB_ICONERROR);
return false;
}
if (sysProgressDlg.HasUserCancelled())
{
CMessageBox::Show(nullptr, IDS_USERCANCELLED, IDS_APPNAME, MB_OK);
return false;
}
int pos = 0;
CString token = cmdout.Tokenize(_T("\n"), pos);
while (!token.IsEmpty())
{
if (token.Mid(0, 13) == _T("Would remove "))
{
CString tempPath = token.Mid(13).TrimRight();
if (quotepath)
tempPath = UnescapeQuotePath(tempPath.Trim(_T('"')));
delList.AddPath(pGit->CombinePath(tempPath));
}
token = cmdout.Tokenize(_T("\n"), pos);
}
if (sysProgressDlg.HasUserCancelled())
{
CMessageBox::Show(nullptr, IDS_USERCANCELLED, IDS_APPNAME, MB_OK);
return false;
}
return true;
}
示例9: logs
int CGitLogList::CherryPickFrom(CString from, CString to)
{
CLogDataVector logs(&m_LogCache);
CString range;
range.Format(_T("%s..%s"), (LPCTSTR)from, (LPCTSTR)to);
if (logs.ParserFromLog(nullptr, 0, 0, &range))
return -1;
if (logs.empty())
return 0;
CSysProgressDlg progress;
progress.SetTitle(CString(MAKEINTRESOURCE(IDS_PROGS_TITLE_CHERRYPICK)));
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.ShowModeless(this);
CBlockCacheForPath cacheBlock(g_Git.m_CurrentDir);
for (int i = (int)logs.size() - 1; i >= 0; i--)
{
if (progress.IsVisible())
{
progress.FormatNonPathLine(1, IDS_PROC_PICK, logs.GetGitRevAt(i).m_CommitHash.ToString());
progress.FormatNonPathLine(2, _T("%s"), (LPCTSTR)logs.GetGitRevAt(i).GetSubject());
progress.SetProgress64(logs.size() - i, logs.size());
}
if (progress.HasUserCancelled())
{
throw std::exception(CUnicodeUtils::GetUTF8(CString(MAKEINTRESOURCE(IDS_USERCANCELLED))));
}
CString cmd,out;
cmd.Format(_T("git.exe cherry-pick %s"), (LPCTSTR)logs.GetGitRevAt(i).m_CommitHash.ToString());
out.Empty();
if(g_Git.Run(cmd,&out,CP_UTF8))
{
throw std::exception(CUnicodeUtils::GetUTF8(CString(MAKEINTRESOURCE(IDS_PROC_CHERRYPICKFAILED)) + _T(":\r\n\r\n") + out));
}
}
return 0;
}
示例10: askIfUserWantsToStashPop
void SVNRebaseCommand::askIfUserWantsToStashPop()
{
if(CMessageBox::Show(NULL, IDS_DCOMMIT_STASH_POP, IDS_APPNAME, MB_YESNO|MB_ICONINFORMATION) == IDYES)
{
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROC_STASHRUNNING)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.SetCancelMsg(IDS_PROGRS_INFOFAILED);
sysProgressDlg.ShowModeless((HWND)NULL, true);
CString cmd,out;
cmd=_T("git.exe stash pop");
if (g_Git.Run(cmd, &out, CP_UTF8))
{
sysProgressDlg.Stop();
CMessageBox::Show(NULL,out,_T("TortoiseGit"), MB_OK);
}
sysProgressDlg.Stop();
}
}
示例11: PatchAll
void CFilePatchesDlg::PatchAll()
{
if (m_pCallBack)
{
CSysProgressDlg progDlg;
progDlg.SetTitle(IDR_MAINFRAME);
progDlg.SetShowProgressBar(true);
progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_ALL)));
progDlg.ShowModeless(m_hWnd);
BOOL ret = TRUE;
for (int i=0; i<m_arFileStates.GetCount() && !progDlg.HasUserCancelled() && ret == TRUE; i++)
{
if (m_arFileStates.GetAt(i)!= FPDLG_FILESTATE_PATCHED)
{
progDlg.SetLine(2, m_pPatch->GetFullPath(m_sPath, i), true);
ret = m_pCallBack->PatchFile(i, true, false);
}
progDlg.SetProgress64(i, m_arFileStates.GetCount());
}
progDlg.Stop();
}
}
示例12: Refresh
void CDeleteRemoteTagDlg::Refresh()
{
m_ctrlTags.DeleteAllItems();
m_SelectAll.SetCheck(BST_UNCHECKED);
m_taglist.clear();
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_LOADING)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.ShowModal(this, true);
g_Git.GetRemoteTags(m_sRemote, m_taglist);
sysProgressDlg.Stop();
for (int i = 0; i < (int)m_taglist.size(); ++i)
{
m_ctrlTags.InsertItem(i, m_taglist[i]);
}
DialogEnableWindow(IDOK, FALSE);
}
示例13: GetSelectedCount
void CDeleteRemoteTagDlg::OnBnClickedOk()
{
if (m_ctrlTags.GetSelectedCount() > 1)
{
CString msg;
msg.Format(IDS_PROC_DELETENREFS, m_ctrlTags.GetSelectedCount());
if (CMessageBox::Show(m_hWnd, msg, _T("TortoiseGit"), 2, IDI_QUESTION, CString(MAKEINTRESOURCE(IDS_DELETEBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 2)
return;
}
else // GetSelectedCount() is 1, otherwise the button is disabled
{
POSITION pos = m_ctrlTags.GetFirstSelectedItemPosition();
CString msg;
msg.Format(IDS_PROC_DELETEBRANCHTAG, m_taglist[(m_ctrlTags.GetNextSelectedItem(pos))]);
if (CMessageBox::Show(m_hWnd, msg, _T("TortoiseGit"), 2, IDI_QUESTION, CString(MAKEINTRESOURCE(IDS_DELETEBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 2)
return;
}
CMassiveGitTask mgtPush(_T("push ") + m_sRemote, FALSE);
POSITION pos = m_ctrlTags.GetFirstSelectedItemPosition();
int index;
while ((index = m_ctrlTags.GetNextSelectedItem(pos)) >= 0)
{
mgtPush.AddFile(_T(":refs/tags/") + m_taglist[index]);
}
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_DELETING_REMOTE_REFS)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.ShowModal(this, true);
BOOL cancel = FALSE;
mgtPush.Execute(cancel);
sysProgressDlg.Stop();
Refresh();
}
示例14: Execute
bool SVNRebaseCommand::Execute()
{
if (!GitAdminDir::HasAdminDir(g_Git.m_CurrentDir))
{
CMessageBox::Show(GetExplorerHWND(), IDS_NOWORKINGCOPY, IDS_APPNAME, MB_ICONERROR);
return false;
}
bool isStash = false;
if(!g_Git.CheckCleanWorkTree())
{
if (CMessageBox::Show(GetExplorerHWND(), g_Git.m_CurrentDir + L"\r\n" + CString(MAKEINTRESOURCE(IDS_ERROR_NOCLEAN_STASH)), L"TortoiseGit", 1, IDI_QUESTION, CString(MAKEINTRESOURCE(IDS_STASHBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 1)
{
CSysProgressDlg sysProgressDlg;
sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROC_STASHRUNNING)));
sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
sysProgressDlg.SetShowProgressBar(false);
sysProgressDlg.SetCancelMsg(IDS_PROGRS_INFOFAILED);
sysProgressDlg.ShowModeless(static_cast<HWND>(nullptr), true);
CString out;
if (g_Git.Run(L"git.exe stash", &out, CP_UTF8))
{
sysProgressDlg.Stop();
MessageBox(GetExplorerHWND(), out, L"TortoiseGit", MB_OK | MB_ICONERROR);
return false;
}
sysProgressDlg.Stop();
isStash = true;
}
else
{
return false;
}
}
CRebaseDlg dlg;
// dlg.m_PreCmd=L"git.exe svn fetch";
CString out, err;
if (!g_Git.Run(L"git.exe config svn-remote.svn.fetch", &out, &err, CP_UTF8))
{
int start = out.Find(L':');
if( start >=0 )
out=out.Mid(start);
if (CStringUtils::StartsWith(out, L":refs"))
out = out.Mid(static_cast<int>(wcslen(L":refs")) + 1);
start = 0;
out = out.Tokenize(L"\n", start);
}
else
{
MessageBox(GetExplorerHWND(), L"Could not get \"svn-remote.svn.fetch\" config value.\n" + out + L'\n' + err, L"TortoiseGit", MB_OK | MB_ICONERROR);
return false;
}
dlg.m_Upstream=out;
CGitHash UpStreamOldHash,HeadHash,UpStreamNewHash;
if (g_Git.GetHash(UpStreamOldHash, out))
{
MessageBox(GetExplorerHWND(), g_Git.GetGitLastErr(L"Could not get hash of SVN branch."), L"TortoiseGit", MB_ICONERROR);
return false;
}
if (g_Git.GetHash(HeadHash, L"HEAD"))
{
MessageBox(GetExplorerHWND(), g_Git.GetGitLastErr(L"Could not get HEAD hash."), L"TortoiseGit", MB_ICONERROR);
return false;
}
CProgressDlg progress;
progress.m_GitCmd = L"git.exe svn fetch";
progress.m_AutoClose = AUTOCLOSE_IF_NO_ERRORS;
if(progress.DoModal()!=IDOK)
return false;
if(progress.m_GitStatus)
return false;
if (g_Git.GetHash(UpStreamNewHash, out))
{
MessageBox(GetExplorerHWND(), g_Git.GetGitLastErr(L"Could not get upstream hash after fetching."), L"TortoiseGit", MB_ICONERROR);
return false;
}
//everything updated
if(UpStreamNewHash==HeadHash)
{
MessageBox(GetExplorerHWND(), g_Git.m_CurrentDir + L"\r\n" + CString(MAKEINTRESOURCE(IDS_PROC_EVERYTHINGUPDATED)), L"TortoiseGit", MB_OK | MB_ICONQUESTION);
if(isStash)
askIfUserWantsToStashPop();
return true;
}
//.........这里部分代码省略.........
示例15: dropPath
bool PasteMoveCommand::Execute()
{
CString sDroppath = parser.GetVal(_T("droptarget"));
CTGitPath dropPath(sDroppath);
if (dropPath.IsAdminDir())
return FALSE;
if(!dropPath.HasAdminDir(&g_Git.m_CurrentDir))
return FALSE;
GitStatus status;
unsigned long count = 0;
orgPathList.RemoveAdminPaths();
CString sNewName;
CSysProgressDlg progress;
progress.SetTitle(IDS_PROC_MOVING);
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
for (int nPath = 0; nPath < orgPathList.GetCount(); ++nPath)
{
CTGitPath destPath;
if (sNewName.IsEmpty())
destPath = CTGitPath(sDroppath+_T("\\")+orgPathList[nPath].GetFileOrDirectoryName());
else
destPath = CTGitPath(sDroppath+_T("\\")+sNewName);
if (destPath.Exists())
{
CString name = orgPathList[nPath].GetFileOrDirectoryName();
if (!sNewName.IsEmpty())
name = sNewName;
progress.Stop();
CRenameDlg dlg;
dlg.m_name = name;
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMEMOVE, (LPCTSTR)name);
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
destPath.SetFromWin(sDroppath+_T("\\")+dlg.m_name);
}
CString top;
top.Empty();
orgPathList[nPath].HasAdminDir(&top);
git_wc_status_kind s = status.GetAllStatus(orgPathList[nPath]);
if ((s == git_wc_status_none)||(s == git_wc_status_unversioned)||(s == git_wc_status_ignored)||top != g_Git.m_CurrentDir)
{
// source file is unversioned: move the file to the target, then add it
MoveFile(orgPathList[nPath].GetWinPath(), destPath.GetWinPath());
CString cmd,output;
cmd.Format(_T("git.exe add -- \"%s\""),destPath.GetWinPath());
if (g_Git.Run(cmd, &output, CP_UTF8))
//if (!Git.Add(CTGitorgPathList(destPath), &props, Git_depth_infinity, true, false, true))
{
TRACE(_T("%s\n"), output);
CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONERROR);
return FALSE; //get out of here
}
CShellUpdater::Instance().AddPathForUpdate(destPath);
}
else
{
CString cmd,output;
cmd.Format(_T("git.exe mv \"%s\" \"%s\""),orgPathList[nPath].GetGitPathString(),destPath.GetGitPathString());
if (g_Git.Run(cmd, &output, CP_UTF8))
//if (!Git.Move(CTGitorgPathList(orgPathList[nPath]), destPath, FALSE))
{
#if 0
if (Git.Err && (Git.Err->apr_err == Git_ERR_UNVERSIONED_RESOURCE ||
Git.Err->apr_err == Git_ERR_CLIENT_MODIFIED))
{
// file/folder seems to have local modifications. Ask the user if
// a force is requested.
CString temp = Git.GetLastErrorMessage();
CString sQuestion(MAKEINTRESOURCE(IDS_PROC_FORCEMOVE));
temp += _T("\n") + sQuestion;
if (CMessageBox::Show(hwndExplorer, temp, _T("TortoiseGit"), MB_YESNO)==IDYES)
{
if (!Git.Move(CTGitPathList(pathList[nPath]), destPath, TRUE))
{
CMessageBox::Show(hwndExplorer, Git.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);
return FALSE; //get out of here
}
CShellUpdater::Instance().AddPathForUpdate(destPath);
}
}
else
#endif
{
TRACE(_T("%s\n"), (LPCTSTR)output);
CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONERROR);
return FALSE; //get out of here
}
}
else
CShellUpdater::Instance().AddPathForUpdate(destPath);
}
++count;
if (progress.IsValid())
{
//.........这里部分代码省略.........