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