Replace var++ by ++var and use size_t where necessary
[TortoiseGit.git] / src / TortoiseProc / Commands / ResolveCommand.cpp
bloba464f9d1d1907c5aebab6cc7b0539776328ed6e8
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 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 "ResolveCommand.h"
22 #include "AppUtils.h"
23 #include "MessageBox.h"
24 #include "ResolveDlg.h"
25 #include "GITProgressDlg.h"
27 bool ResolveCommand::Execute()
29 CResolveDlg dlg;
30 dlg.m_pathList = pathList;
31 INT_PTR ret = IDOK;
32 if (!parser.HasKey(_T("noquestion")))
33 ret = dlg.DoModal();
34 if (ret == IDOK)
36 if (dlg.m_pathList.GetCount())
38 if (parser.HasKey(L"silent"))
40 for (int i = 0; i < dlg.m_pathList.GetCount(); ++i)
42 CString cmd, out;
43 cmd.Format(_T("git.exe add -f -- \"%s\""), dlg.m_pathList[i].GetGitPathString());
44 if (g_Git.Run(cmd, &out, CP_UTF8))
46 CMessageBox::Show(NULL, out, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
47 return false;
50 CAppUtils::RemoveTempMergeFile((CTGitPath &)dlg.m_pathList[i]);
52 return true;
54 else
56 CGitProgressDlg progDlg(CWnd::FromHandle(hWndExplorer));
57 theApp.m_pMainWnd = &progDlg;
58 progDlg.SetCommand(CGitProgressDlg::GitProgress_Resolve);
59 if (parser.HasVal(_T("closeonend")))
60 progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
61 progDlg.SetOptions(parser.HasKey(_T("skipcheck")) ? ProgOptSkipConflictCheck : ProgOptNone);
62 progDlg.SetPathList(dlg.m_pathList);
63 progDlg.DoModal();
64 return !progDlg.DidErrorsOccur();
68 return false;