1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2013, 2015-2018 - 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.
21 #include "ImportPatchCommand.h"
22 #include "ImportPatchDlg.h"
27 bool ImportPatchCommand::Execute()
33 CString droppath
= parser
.GetVal(L
"droptarget");
34 if (!droppath
.IsEmpty())
36 if (CTGitPath(droppath
).IsAdminDir())
39 if (!CTGitPath(droppath
).HasAdminDir(&g_Git
.m_CurrentDir
))
42 err
.Format(IDS_ERR_NOT_REPOSITORY
, (LPCTSTR
)g_Git
.m_CurrentDir
);
43 MessageBox(hwndExplorer
, err
, L
"TortoiseGit", MB_OK
| MB_ICONERROR
);
47 else if (!orgPathList
.IsEmpty() && !orgPathList
[0].HasAdminDir())
49 CString str
= CAppUtils::ChooseRepository(hwndExplorer
, nullptr);
56 if(!path
.HasAdminDir())
59 err
.Format(IDS_ERR_NOT_REPOSITORY
, (LPCTSTR
)str
);
60 MessageBox(hwndExplorer
, err
, L
"TortoiseGit", MB_OK
| MB_ICONERROR
);
63 g_Git
.m_CurrentDir
=str
;
66 for(int i
= 0 ; i
< this->orgPathList
.GetCount(); ++i
)
68 if(!orgPathList
[i
].IsDirectory())
69 dlg
.m_PathList
.AddPath(orgPathList
[i
]);
72 if(dlg
.DoModal()==IDOK
)