Commit d0695b6d authored by Sven Strickroth's avatar Sven Strickroth

Allow to use drag'n'drop to import a patch serial

Signed-off-by: Sven Strickroth's avatarSven Strickroth <email@cs-ware.de>
parent 1905b87e
......@@ -32,7 +32,21 @@ bool ImportPatchCommand::Execute()
CString cmd;
CString output;
if (!orgPathList.IsEmpty() && !orgPathList[0].HasAdminDir())
CString droppath = parser.GetVal(_T("droptarget"));
if (!droppath.IsEmpty())
{
if (CTGitPath(droppath).IsAdminDir())
return FALSE;
if (!CTGitPath(droppath).HasAdminDir(&g_Git.m_CurrentDir))
{
CString err;
err.Format(IDS_ERR_NOT_REPOSITORY, (LPCTSTR)g_Git.m_CurrentDir);
CMessageBox::Show(nullptr, err, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
return FALSE;
}
}
else if (!orgPathList.IsEmpty() && !orgPathList[0].HasAdminDir())
{
CString str=CAppUtils::ChooseRepository(NULL);
if(str.IsEmpty())
......
......@@ -114,7 +114,6 @@ STDMETHODIMP CShellExt::Initialize_Wrap(LPCITEMIDLIST pIDFolder,
stdstring str = stdstring(szFileName.get());
if ((!str.empty()) && (g_ShellCache.IsContextPathAllowed(szFileName.get())))
{
if (itemStates & ITEMIS_ONLYONE)
{
CTGitPath strpath;
strpath.SetFromWin(str.c_str());
......@@ -834,7 +833,11 @@ STDMETHODIMP CShellExt::QueryDropContext(UINT uFlags, UINT idCmdFirst, HMENU hMe
// apply patch
// available if source is a patchfile
if (itemStates & ITEMIS_PATCHFILE)
InsertGitMenu(FALSE, hMenu, indexMenu++, idCmd++, IDS_MENUAPPLYPATCH, 0, idCmdFirst, ShellMenuApplyPatch, uFlags);
{
if (itemStates & ITEMIS_ONLYONE)
InsertGitMenu(FALSE, hMenu, indexMenu++, idCmd++, IDS_MENUAPPLYPATCH, 0, idCmdFirst, ShellMenuApplyPatch, uFlags);
InsertGitMenu(FALSE, hMenu, indexMenu++, idCmd++, IDS_MENUIMPORTPATCH, 0, idCmdFirst, ShellMenuImportPatchDrop, uFlags);
}
// separator
if (idCmd != idCmdFirst)
......@@ -1644,6 +1647,9 @@ STDMETHODIMP CShellExt::InvokeCommand_Wrap(LPCMINVOKECOMMANDINFO lpcmi)
case ShellMenuImportPatch:
AddPathFileCommand(gitCmd, L"importpatch");
break;
case ShellMenuImportPatchDrop:
AddPathFileDropCommand(gitCmd, L"importpatch");
break;
case ShellMenuFetch:
AddPathCommand(gitCmd, L"fetch", false);
break;
......
......@@ -84,6 +84,7 @@ enum GitCommands
ShellMenuDaemon,
ShellMenuMergeAbort,
ShellMenuDiffLater,
ShellMenuImportPatchDrop,
ShellMenuLastEntry // used to mark the menu array end
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment