1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2007-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "DropExportCommand.h"
\r
21 #include "MessageBox.h"
\r
23 #include "GitAdminDir.h"
\r
24 #include "DirFileEnum.h"
\r
25 #include "SysProgressDlg.h"
\r
27 bool DropExportCommand::Execute()
\r
31 CString droppath = parser.GetVal(_T("droptarget"));
\r
32 if (CTGitPath(droppath).IsAdminDir())
\r
36 if ((pathList.GetCount() == 1)&&
\r
37 (pathList[0].IsEquivalentTo(CTSVNPath(droppath))))
\r
39 // exporting to itself:
\r
40 // remove all svn admin dirs, effectively unversion the 'exported' folder.
\r
42 msg.Format(IDS_PROC_EXPORTUNVERSION, (LPCTSTR)droppath);
\r
43 if (CMessageBox::Show(hwndExplorer, msg, _T("TortoiseGit"), MB_ICONQUESTION|MB_YESNO) == IDYES)
\r
45 CProgressDlg progress;
\r
46 progress.SetTitle(IDS_PROC_UNVERSION);
\r
47 progress.SetAnimation(IDR_MOVEANI);
\r
48 progress.FormatNonPathLine(1, IDS_SVNPROGRESS_EXPORTINGWAIT);
\r
49 progress.SetTime(true);
\r
50 progress.ShowModeless(hwndExplorer);
\r
51 std::vector<CTSVNPath> removeVector;
\r
53 CDirFileEnum lister(droppath);
\r
55 bool bFolder = false;
\r
56 while (lister.NextFile(srcFile, &bFolder))
\r
58 CTSVNPath item(srcFile);
\r
59 if ((bFolder)&&(g_SVNAdminDir.IsAdminDirName(item.GetFileOrDirectoryName())))
\r
61 removeVector.push_back(item);
\r
65 for (std::vector<CTSVNPath>::iterator it = removeVector.begin(); (it != removeVector.end()) && (!progress.HasUserCancelled()); ++it)
\r
67 progress.FormatPathLine(1, IDS_SVNPROGRESS_UNVERSION, (LPCTSTR)it->GetWinPath());
\r
68 progress.SetProgress(count, removeVector.size());
\r
79 for(int nPath = 0; nPath < pathList.GetCount(); nPath++)
\r
81 CString dropper = droppath + _T("\\") + pathList[nPath].GetFileOrDirectoryName();
\r
82 if (PathFileExists(dropper))
\r
85 CString sBtn1(MAKEINTRESOURCE(IDS_PROC_OVERWRITEEXPORT_OVERWRITE));
\r
86 CString sBtn2(MAKEINTRESOURCE(IDS_PROC_OVERWRITEEXPORT_RENAME));
\r
87 CString sBtn3(MAKEINTRESOURCE(IDS_PROC_OVERWRITEEXPORT_CANCEL));
\r
88 sMsg.Format(IDS_PROC_OVERWRITEEXPORT, (LPCTSTR)dropper);
\r
89 UINT ret = CMessageBox::Show(hwndExplorer, sMsg, _T("TortoiseGit"), MB_DEFBUTTON1, IDI_QUESTION, sBtn1, sBtn2, sBtn3);
\r
92 dropper.Format(IDS_PROC_EXPORTFOLDERNAME, (LPCTSTR)droppath, (LPCTSTR)pathList[nPath].GetFileOrDirectoryName());
\r
93 int exportcount = 1;
\r
94 while (PathFileExists(dropper))
\r
96 dropper.Format(IDS_PROC_EXPORTFOLDERNAME2, (LPCTSTR)droppath, exportcount++, (LPCTSTR)pathList[nPath].GetFileOrDirectoryName());
\r
102 if (!svn.Export(pathList[nPath], CTSVNPath(dropper), SVNRev::REV_WC ,SVNRev::REV_WC, FALSE, FALSE, svn_depth_infinity, hwndExplorer, parser.HasKey(_T("extended"))))
\r
104 CMessageBox::Show(hwndExplorer, svn.GetLastErrorMessage(), _T("TortoiseGit"), MB_OK | MB_ICONERROR);
\r