libgit2: Enable fetch function
[TortoiseGit.git] / src / TortoiseProc / Commands / AddCommand.cpp
blobe1a7e59f599e782e9cbdf80edbdcb5a0e6dded90
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.
19 #include "stdafx.h"
20 #include "AddCommand.h"
22 #include "AddDlg.h"
23 #include "GITProgressDlg.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 (dlg.m_pathList.GetCount() == 0)
59 return FALSE;
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());
67 progDlg.DoModal();
69 CShellUpdater::Instance().AddPathsForUpdate(dlg.m_pathList);
71 bRet = !progDlg.DidErrorsOccur();
74 // }
76 CShellUpdater::Instance().Flush();
77 return bRet;