1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2014 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "ResolveProgressCommand.h"
21 #include "ShellUpdater.h"
24 bool ResolveProgressCommand::Run(CGitProgressList
* list
, CString
& sWindowTitle
, int& m_itemCountTotal
, int& m_itemCount
)
26 ASSERT(m_targetPathList
.GetCount() == 1);
27 list
->SetWindowTitle(IDS_PROGRS_TITLE_RESOLVE
, g_Git
.CombinePath(m_targetPathList
.GetCommonRoot().GetUIPathString()), sWindowTitle
);
28 list
->SetBackgroundImage(IDI_RESOLVE_BKG
);
30 m_itemCountTotal
= m_targetPathList
.GetCount();
31 for (m_itemCount
= 0; m_itemCount
< m_itemCountTotal
; ++m_itemCount
)
33 CString cmd
, out
, tempmergefile
;
34 cmd
.Format(_T("git.exe add -f -- \"%s\""), m_targetPathList
[m_itemCount
].GetGitPathString());
35 if (g_Git
.Run(cmd
, &out
, CP_UTF8
))
37 list
->ReportError(out
);
41 CAppUtils::RemoveTempMergeFile((CTGitPath
&)m_targetPathList
[m_itemCount
]);
43 list
->AddNotify(new CGitProgressList::WC_File_NotificationData(m_targetPathList
[m_itemCount
], CGitProgressList::WC_File_NotificationData::git_wc_notify_resolved
));
46 CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList
);
48 m_PostCmdCallback
= [](DWORD status
, PostCmdList
& postCmdList
)
53 postCmdList
.push_back(PostCmd(IDI_COMMIT
, IDS_MENUCOMMIT
, []
56 sCmd
.Format(_T("/command:commit /path:\"%s\""), g_Git
.m_CurrentDir
);
57 CAppUtils::RunTortoiseGitProc(sCmd
);
64 bool ResolveProgressCommand::ShowInfo(CString
& info
)
66 info
= _T("You need commit your change after resolve conflict");