Renamed Tortoise*.exe to TortoiseGit*.exe
[TortoiseGit.git] / src / TortoiseProc / Commands / RebaseCommand.cpp
blob8fcd4a0bd8c8044fabea02520f1f27a7eab33406
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2012 - 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 "InputLogDlg.h"
26 #include "Git.h"
27 #include "DirFileEnum.h"
28 #include "ShellUpdater.h"
29 #include "SysProgressDlg.h"
30 #include "AppUtils.h"
32 bool RebaseCommand::Execute()
34 bool bRet =false;
36 if(!g_Git.CheckCleanWorkTree())
38 if (CMessageBox::Show(NULL, IDS_ERROR_NOCLEAN_STASH, IDS_APPNAME, 1, IDI_QUESTION, IDS_STASHBUTTON, IDS_ABORTBUTTON) == 1)
40 CSysProgressDlg sysProgressDlg;
41 sysProgressDlg.SetTitle(CString(MAKEINTRESOURCE(IDS_APPNAME)));
42 sysProgressDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PROC_STASHRUNNING)));
43 sysProgressDlg.SetLine(2, CString(MAKEINTRESOURCE(IDS_PROGRESSWAIT)));
44 sysProgressDlg.SetShowProgressBar(false);
45 sysProgressDlg.SetCancelMsg(IDS_PROGRS_INFOFAILED);
46 sysProgressDlg.ShowModeless((HWND)NULL, true);
48 CString cmd,out;
49 cmd=_T("git.exe stash");
50 if (g_Git.Run(cmd, &out, CP_UTF8))
52 sysProgressDlg.Stop();
53 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK);
54 return false;
56 sysProgressDlg.Stop();
58 else
60 return false;
64 while(1)
66 CRebaseDlg dlg;
67 dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_MENULOG)));
68 dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_PROC_RESTARTREBASE)));
69 INT_PTR ret = dlg.DoModal();
70 if( ret == IDOK)
72 bRet=true;
73 return bRet;
75 if( ret == IDCANCEL)
77 bRet=false;
78 return bRet;
80 if (ret == IDC_REBASE_POST_BUTTON)
82 CString cmd = _T("/command:log");
83 cmd += _T(" /path:\"") + g_Git.m_CurrentDir + _T("\"");
84 CAppUtils::RunTortoiseGitProc(cmd);
85 return true;
88 return bRet;