1 // TortoiseGit - 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 "GITProgressDlg.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
)
58 if (dlg
.m_pathList
.GetCount() == 0)
60 CGitProgressDlg progDlg
;
61 theApp
.m_pMainWnd
= &progDlg
;
62 progDlg
.SetCommand(CGitProgressDlg::GitProgress_Add
);
63 if (parser
.HasVal(_T("closeonend")))
64 progDlg
.SetAutoClose(parser
.GetLongVal(_T("closeonend")));
65 progDlg
.SetPathList(dlg
.m_pathList
);
66 progDlg
.SetItemCount(dlg
.m_pathList
.GetCount());
69 CShellUpdater::Instance().AddPathsForUpdate(dlg
.m_pathList
);
71 bRet
= !progDlg
.DidErrorsOccur();
76 CShellUpdater::Instance().Flush();