Add Shell Notification at add, cleanup and remove and rename, CommitDlg.cpp
[TortoiseGit.git] / src / TortoiseProc / Commands / AddCommand.cpp
blob984a377981fda8deed921ab0c0d84cd9f06cb6ad
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2008 - TortoiseSVN
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.
19 #include "StdAfx.h"
20 #include "AddCommand.h"
22 #include "AddDlg.h"
23 #include "SVNProgressDlg.h"
24 #include "ShellUpdater.h"
25 #include "messagebox.h"
27 bool AddCommand::Execute()
29 bool bRet = false;
30 if (parser.HasKey(_T("noui")))
32 #if 0
33 SVN svn;
34 ProjectProperties props;
35 props.ReadPropsPathList(pathList);
36 bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
37 CShellUpdater::Instance().AddPathsForUpdate(pathList);
38 #endif
40 else
42 #if 0
43 if (pathList.AreAllPathsFiles())
45 SVN svn;
46 ProjectProperties props;
47 props.ReadPropsPathList(pathList);
48 bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
49 CShellUpdater::Instance().AddPathsForUpdate(pathList);
51 else
53 #endif
54 CAddDlg dlg;
55 dlg.m_pathList = pathList;
56 if (dlg.DoModal() == IDOK)
58 #if 0
59 CString cmd,out;
60 int success=0;
61 for(int i=0;i<dlg.m_pathList.GetCount();i++)
63 cmd.Format(_T("git.exe add \"%s\""),dlg.m_pathList[i].GetGitPathString());
64 if(g_Git.Run(cmd,&out,CP_OEMCP))
66 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
68 success++;
70 CString message;
71 message.Format(_T("%d file added"),success);
72 CMessageBox::Show(NULL,message,_T("TortoiseGit"),MB_OK);
73 return TRUE;
74 #endif
76 if (dlg.m_pathList.GetCount() == 0)
77 return FALSE;
78 CGitProgressDlg progDlg;
79 theApp.m_pMainWnd = &progDlg;
80 progDlg.SetCommand(CGitProgressDlg::GitProgress_Add);
81 if (parser.HasVal(_T("closeonend")))
82 progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
83 progDlg.SetPathList(dlg.m_pathList);
84 //ProjectProperties props;
85 //props.ReadPropsPathList(dlg.m_pathList);
86 //progDlg.SetProjectProperties(props);
87 progDlg.SetItemCount(dlg.m_pathList.GetCount());
88 progDlg.DoModal();
90 CShellUpdater::Instance().AddPathsForUpdate(dlg.m_pathList);
92 bRet = !progDlg.DidErrorsOccur();
95 // }
97 CShellUpdater::Instance().Flush();
98 return bRet;