#include "PropDlg.h"\r
#include "SVNProgressDlg.h"\r
#include "ProgressDlg.h"\r
+#include "SysProgressDlg.h"\r
//#include "RepositoryBrowser.h"\r
//#include "CopyDlg.h"\r
//#include "StatGraphDlg.h"\r
\r
IMPLEMENT_DYNAMIC(CGitLogList, CHintListCtrl)\r
\r
+int CGitLogList::CherryPickFrom(CString from, CString to)\r
+{\r
+ CLogDataVector logs;\r
+ if(logs.ParserFromLog(NULL,-1,0,&from,&to))\r
+ return -1;\r
+\r
+ if(logs.size() == 0)\r
+ return 0;\r
+\r
+ CSysProgressDlg progress;\r
+ if (progress.IsValid())\r
+ {\r
+ progress.SetTitle(_T("Cherry Pick"));\r
+ progress.SetAnimation(IDR_MOVEANI);\r
+ progress.SetTime(true);\r
+ progress.ShowModeless(this);\r
+ }\r
+\r
+ for(int i=logs.size()-1;i>=0;i--)\r
+ {\r
+ if (progress.IsValid())\r
+ {\r
+ progress.FormatPathLine(1, _T("Pick up %s"), logs[i].m_CommitHash);\r
+ progress.FormatPathLine(2, _T("%s"), logs[i].m_Subject);\r
+ progress.SetProgress(logs.size()-i, logs.size());\r
+ }\r
+ if ((progress.IsValid())&&(progress.HasUserCancelled()))\r
+ {\r
+ //CMessageBox::Show(hwndExplorer, IDS_SVN_USERCANCELLED, IDS_APPNAME, MB_ICONINFORMATION);\r
+ throw std::exception(CUnicodeUtils::GetUTF8(_T("User canceled\r\n\r\n")));\r
+ return -1;\r
+ }\r
+ CString cmd,out;\r
+ cmd.Format(_T("git.exe cherry-pick %s"),logs[i].m_CommitHash);\r
+ out.Empty();\r
+ if(g_Git.Run(cmd,&out,CP_UTF8))\r
+ {\r
+ throw std::exception(CUnicodeUtils::GetUTF8(CString(_T("Cherry Pick Failure\r\n\r\n"))+out));\r
+ return -1;\r
+ }\r
+ }\r
+ \r
+ return 0;\r
+}\r
+\r
void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)\r
{ \r
POSITION pos = GetFirstSelectedItemPosition();\r
//\r
//Later the progress dialog could be used to execute these steps.\r
\r
+ if(CherryPickFrom(pFirstEntry->m_CommitHash,headhash))\r
+ {\r
+ CString msg;\r
+ msg.Format(_T("Error while cherry pick commits on top of combined commits. Aborting.\r\n\r\n"));\r
+ throw std::exception(CUnicodeUtils::GetUTF8(msg));\r
+ }\r
+#if 0\r
CString currentBranch=g_Git.GetCurrentBranch();\r
cmd.Format(_T("git.exe rebase --onto \"%s\" %s %s"),\r
currentBranch,\r
cmd.Format(_T("git.exe reset --hard %s"),newHead);\r
if(g_Git.Run(cmd,&out,CP_UTF8))\r
throw std::exception(CUnicodeUtils::GetUTF8(_T("Could not reset to new head. Aborting...\r\n\r\n")+out));\r
+#endif\r
}\r
}\r
else\r