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.
20 #include "AddCommand.h"
23 #include "SVNProgressDlg.h"
24 #include "ShellUpdater.h"
25 #include "messagebox.h"
27 bool AddCommand::Execute()
30 if (parser
.HasKey(_T("noui")))
34 ProjectProperties props
;
35 props
.ReadPropsPathList(pathList
);
36 bRet
= !!svn
.Add(pathList
, &props
, svn_depth_empty
, FALSE
, FALSE
, TRUE
);
37 CShellUpdater::Instance().AddPathsForUpdate(pathList
);
43 if (pathList
.AreAllPathsFiles())
46 ProjectProperties props
;
47 props
.ReadPropsPathList(pathList
);
48 bRet
= !!svn
.Add(pathList
, &props
, svn_depth_empty
, FALSE
, FALSE
, TRUE
);
49 CShellUpdater::Instance().AddPathsForUpdate(pathList
);
55 dlg
.m_pathList
= pathList
;
56 if (dlg
.DoModal() == IDOK
)
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_ACP
))
66 CMessageBox::Show(NULL
,out
,_T("TortoiseGit"),MB_OK
|MB_ICONERROR
);
71 message
.Format(_T("%d file added"),success
);
72 CMessageBox::Show(NULL
,message
,_T("TortoiseGit"),MB_OK
);
76 if (dlg
.m_pathList
.GetCount() == 0)
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());
90 CShellUpdater::Instance().AddPathsForUpdate(dlg
.m_pathList
);
92 bRet
= !progDlg
.DidErrorsOccur();
97 CShellUpdater::Instance().Flush();