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 "UpdateCommand.h"
\r
22 #include "UpdateDlg.h"
\r
23 #include "SVNProgressDlg.h"
\r
25 #include "MessageBox.h"
\r
27 bool UpdateCommand::Execute()
\r
29 SVNRev rev = SVNRev(_T("HEAD"));
\r
31 svn_depth_t depth = svn_depth_unknown;
\r
34 if (CHooks::Instance().StartUpdate(pathList, exitcode, error))
\r
39 temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
\r
40 CMessageBox::Show(hwndExplorer, temp, _T("TortoiseSVN"), MB_ICONERROR);
\r
44 if ((parser.HasKey(_T("rev")))&&(!parser.HasVal(_T("rev"))))
\r
47 if (pathList.GetCount()>0)
\r
48 dlg.m_wcPath = pathList[0];
\r
49 if (dlg.DoModal() == IDOK)
\r
52 depth = dlg.m_depth;
\r
53 options |= dlg.m_bNoExternals ? ProgOptIgnoreExternals : 0;
\r
60 if (parser.HasVal(_T("rev")))
\r
61 rev = SVNRev(parser.GetVal(_T("rev")));
\r
62 if (parser.HasKey(_T("nonrecursive")))
\r
63 depth = svn_depth_empty;
\r
64 if (parser.HasKey(_T("ignoreexternals")))
\r
65 options |= ProgOptIgnoreExternals;
\r
68 CSVNProgressDlg progDlg;
\r
69 theApp.m_pMainWnd = &progDlg;
\r
70 progDlg.SetCommand(CSVNProgressDlg::SVNProgress_Update);
\r
71 if (parser.HasVal(_T("closeonend")))
\r
72 progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
\r
73 progDlg.SetOptions(options);
\r
74 progDlg.SetPathList(pathList);
\r
75 progDlg.SetRevision(rev);
\r
76 progDlg.SetDepth(depth);
\r
78 return !progDlg.DidErrorsOccur();
\r