Includes cleanup
[TortoiseGit.git] / src / TortoiseProc / Commands / RebaseCommand.cpp
blob7e9262828c38633da724773e65e2df4950af590a
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2012, 2015 - TortoiseGit
4 // Copyright (C) 2007-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "stdafx.h"
21 #include "RebaseCommand.h"
23 #include "MessageBox.h"
24 #include "RebaseDlg.h"
25 #include "Git.h"
26 #include "SysProgressDlg.h"
27 #include "AppUtils.h"
29 bool RebaseCommand::Execute()
31 bool bRet =false;
33 if(!g_Git.CheckCleanWorkTree())
35 if (CMessageBox::Show(NULL, IDS_ERROR_NOCLEAN_STASH, IDS_APPNAME, 1, IDI_QUESTION, IDS_STASHBUTTON, IDS_ABORTBUTTON) == 1)
37 CSysProgressDlg sysProgressDlg;
38 sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
39 sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROC_STASHRUNNING)));
40 sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
41 sysProgressDlg.SetShowProgressBar(false);
42 sysProgressDlg.SetCancelMsg(IDS_PROGRS_INFOFAILED);
43 sysProgressDlg.ShowModeless((HWND)NULL, true);
45 CString cmd,out;
46 cmd=_T("git.exe stash");
47 if (g_Git.Run(cmd, &out, CP_UTF8))
49 sysProgressDlg.Stop();
50 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK);
51 return false;
53 sysProgressDlg.Stop();
55 else
57 return false;
61 while(1)
63 CRebaseDlg dlg;
64 dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_MENULOG)));
65 dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_PROC_RESTARTREBASE)));
66 INT_PTR ret = dlg.DoModal();
67 if( ret == IDOK)
69 bRet=true;
70 return bRet;
72 if( ret == IDCANCEL)
74 bRet=false;
75 return bRet;
77 if (ret == IDC_REBASE_POST_BUTTON)
79 CString cmd = _T("/command:log");
80 cmd += _T(" /path:\"") + g_Git.m_CurrentDir + _T("\"");
81 CAppUtils::RunTortoiseGitProc(cmd);
82 return true;
85 return bRet;