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 "AddCommand.h"
\r
23 #include "SVNProgressDlg.h"
\r
24 #include "ShellUpdater.h"
\r
25 #include "messagebox.h"
\r
27 bool AddCommand::Execute()
\r
30 if (parser.HasKey(_T("noui")))
\r
34 ProjectProperties props;
\r
35 props.ReadPropsPathList(pathList);
\r
36 bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
\r
37 CShellUpdater::Instance().AddPathsForUpdate(pathList);
\r
43 if (pathList.AreAllPathsFiles())
\r
46 ProjectProperties props;
\r
47 props.ReadPropsPathList(pathList);
\r
48 bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
\r
49 CShellUpdater::Instance().AddPathsForUpdate(pathList);
\r
55 dlg.m_pathList = pathList;
\r
56 if (dlg.DoModal() == IDOK)
\r
61 for(int i=0;i<dlg.m_pathList.GetCount();i++)
\r
63 cmd.Format(_T("git.exe add \"%s\""),dlg.m_pathList[i].GetGitPathString());
\r
64 if(g_Git.Run(cmd,&out,CP_OEMCP))
\r
66 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
\r
71 message.Format(_T("%d file added"),success);
\r
72 CMessageBox::Show(NULL,message,_T("TortoiseGit"),MB_OK);
\r
76 if (dlg.m_pathList.GetCount() == 0)
\r
78 CGitProgressDlg progDlg;
\r
79 theApp.m_pMainWnd = &progDlg;
\r
80 progDlg.SetCommand(CGitProgressDlg::GitProgress_Add);
\r
81 if (parser.HasVal(_T("closeonend")))
\r
82 progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
\r
83 progDlg.SetPathList(dlg.m_pathList);
\r
84 //ProjectProperties props;
\r
85 //props.ReadPropsPathList(dlg.m_pathList);
\r
86 //progDlg.SetProjectProperties(props);
\r
87 progDlg.SetItemCount(dlg.m_pathList.GetCount());
\r
89 bRet = !progDlg.DidErrorsOccur();
\r