1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2015 - TortoiseGit
4 // Copyright (C) 2007-2008,2012 - 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.
21 #include "ResolveCommand.h"
23 #include "MessageBox.h"
24 #include "ResolveDlg.h"
25 #include "GitProgressDlg.h"
26 #include "ProgressCommands/ResolveProgressCommand.h"
28 bool ResolveCommand::Execute()
31 dlg
.m_pathList
= pathList
;
33 if (!parser
.HasKey(_T("noquestion")))
37 if (!dlg
.m_pathList
.IsEmpty())
39 if (parser
.HasKey(L
"silent"))
41 for (int i
= 0; i
< dlg
.m_pathList
.GetCount(); ++i
)
44 cmd
.Format(_T("git.exe add -f -- \"%s\""), (LPCTSTR
)dlg
.m_pathList
[i
].GetGitPathString());
45 if (g_Git
.Run(cmd
, &out
, CP_UTF8
))
47 CMessageBox::Show(NULL
, out
, _T("TortoiseGit"), MB_OK
| MB_ICONERROR
);
51 CAppUtils::RemoveTempMergeFile((CTGitPath
&)dlg
.m_pathList
[i
]);
54 HWND resolveMsgWnd
= parser
.HasVal(L
"resolvemsghwnd") ? (HWND
)parser
.GetLongLongVal(L
"resolvemsghwnd") : 0;
55 if (resolveMsgWnd
&& CRegDWORD(_T("Software\\TortoiseGit\\RefreshFileListAfterResolvingConflict"), TRUE
) == TRUE
)
57 static UINT WM_REVERTMSG
= RegisterWindowMessage(_T("GITSLNM_NEEDSREFRESH"));
58 ::PostMessage(resolveMsgWnd
, WM_REVERTMSG
, NULL
, NULL
);
64 CGitProgressDlg
progDlg(CWnd::FromHandle(hWndExplorer
));
65 theApp
.m_pMainWnd
= &progDlg
;
66 ResolveProgressCommand resolveProgressCommand
;
67 progDlg
.SetCommand(&resolveProgressCommand
);
68 resolveProgressCommand
.SetPathList(dlg
.m_pathList
);
70 return !progDlg
.DidErrorsOccur();