• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revisão29181 (tree)
Hora2021-05-02 21:08:21
Autorstefankueng

Mensagem de Log

cleanup update command

Mudança Sumário

Diff

--- trunk/src/TortoiseProc/Commands/UpdateCommand.cpp (revision 29180)
+++ trunk/src/TortoiseProc/Commands/UpdateCommand.cpp (revision 29181)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2007-2012, 2014 - TortoiseSVN
3+// Copyright (C) 2007-2012, 2014, 2021 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -25,37 +25,36 @@
2525
2626 bool UpdateCommand::Execute()
2727 {
28- CRegDWORD updateExternals(L"Software\\TortoiseSVN\\IncludeExternals", true);
29- SVNRev rev = SVNRev(L"HEAD");
30- int options = DWORD(updateExternals) ? 0 : ProgOptIgnoreExternals;
31- svn_depth_t depth = svn_depth_unknown;
32- DWORD exitcode = 0;
33- CString error;
28+ CRegDWORD updateExternals(L"Software\\TortoiseSVN\\IncludeExternals", true);
29+ SVNRev rev = SVNRev(L"HEAD");
30+ int options = static_cast<DWORD>(updateExternals) ? 0 : ProgOptIgnoreExternals;
31+ svn_depth_t depth = svn_depth_unknown;
32+ DWORD exitCode = 0;
3433 if (pathList.GetCount() == 0)
3534 return false;
3635 ProjectProperties props;
3736 props.ReadPropsPathList(pathList);
3837 CHooks::Instance().SetProjectProperties(pathList.GetCommonRoot(), props);
39- if (CHooks::Instance().StartUpdate(GetExplorerHWND(), pathList, exitcode, error))
38+ if (CString error; CHooks::Instance().StartUpdate(GetExplorerHWND(), pathList, exitCode, error))
4039 {
41- if (exitcode)
40+ if (exitCode)
4241 {
4342 CString temp;
44- temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
43+ temp.Format(IDS_ERR_HOOKFAILED, static_cast<LPCWSTR>(error));
4544 ::MessageBox(GetExplorerHWND(), temp, L"TortoiseSVN", MB_ICONERROR);
4645 return FALSE;
4746 }
4847 }
49- std::map<CString,svn_depth_t> checkoutDepths;
50- CSVNProgressDlg::Command cmd = CSVNProgressDlg::SVNProgress_Update;
51- if ((parser.HasKey(L"rev"))&&(!parser.HasVal(L"rev")))
48+ std::map<CString, svn_depth_t> checkoutDepths;
49+ CSVNProgressDlg::Command cmd = CSVNProgressDlg::SVNProgress_Update;
50+ if ((parser.HasKey(L"rev")) && (!parser.HasVal(L"rev")))
5251 {
5352 CUpdateDlg dlg;
54- if (pathList.GetCount()>0)
53+ if (pathList.GetCount() > 0)
5554 dlg.m_wcPath = pathList[0];
5655 if (dlg.DoModal() == IDOK)
5756 {
58- rev = dlg.Revision;
57+ rev = dlg.m_revision;
5958 depth = dlg.m_depth;
6059 if (dlg.m_bNoExternals)
6160 options |= ProgOptIgnoreExternals;
@@ -69,7 +68,7 @@
6968 if (dlg.m_checkoutDepths.size())
7069 {
7170 checkoutDepths = dlg.m_checkoutDepths;
72- cmd = CSVNProgressDlg::SVNProgress_SparseCheckout;
71+ cmd = CSVNProgressDlg::SVNProgress_SparseCheckout;
7372 }
7473 }
7574 else
@@ -94,7 +93,7 @@
9493 CSVNProgressDlg progDlg;
9594 theApp.m_pMainWnd = &progDlg;
9695 progDlg.SetCommand(cmd);
97- progDlg.SetAutoClose (parser);
96+ progDlg.SetAutoClose(parser);
9897 progDlg.SetOptions(options);
9998 progDlg.SetPathList(pathList);
10099 progDlg.SetRevision(rev);
--- trunk/src/TortoiseProc/Commands/UpdateCommand.h (revision 29180)
+++ trunk/src/TortoiseProc/Commands/UpdateCommand.h (revision 29181)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2007, 2012 - TortoiseSVN
3+// Copyright (C) 2007, 2012, 2021 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -29,7 +29,5 @@
2929 /**
3030 * Executes the command.
3131 */
32- virtual bool Execute() override;
32+ bool Execute() override;
3333 };
34-
35-
--- trunk/src/TortoiseProc/UpdateDlg.cpp (revision 29180)
+++ trunk/src/TortoiseProc/UpdateDlg.cpp (revision 29181)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2007, 2009-2015 - TortoiseSVN
3+// Copyright (C) 2003-2007, 2009-2015, 2021 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -27,10 +27,10 @@
2727 IMPLEMENT_DYNAMIC(CUpdateDlg, CStateStandAloneDialog)
2828 CUpdateDlg::CUpdateDlg(CWnd* pParent /*=NULL*/)
2929 : CStateStandAloneDialog(CUpdateDlg::IDD, pParent)
30- , Revision(L"HEAD")
30+ , m_pLogDlg(nullptr)
31+ , m_revision(L"HEAD")
3132 , m_bNoExternals(CRegDWORD(L"Software\\TortoiseSVN\\noext"))
3233 , m_bStickyDepth(TRUE)
33- , m_pLogDlg(NULL)
3434 , m_depth(svn_depth_unknown)
3535 {
3636 }
@@ -49,7 +49,6 @@
4949 DDX_Control(pDX, IDC_DEPTH, m_depthCombo);
5050 }
5151
52-
5352 BEGIN_MESSAGE_MAP(CUpdateDlg, CStateStandAloneDialog)
5453 ON_BN_CLICKED(IDC_LOG, OnBnClickedShowLog)
5554 ON_REGISTERED_MESSAGE(WM_REVSELECTED, OnRevSelected)
@@ -88,7 +87,7 @@
8887 DialogEnableWindow(IDC_SPARSE, m_wcPath.Exists() && m_wcPath.IsDirectory());
8988
9089 GetDlgItem(IDC_REVNUM)->SetFocus();
91- if ((m_pParentWnd==NULL)&&(GetExplorerHWND()))
90+ if ((m_pParentWnd == nullptr) && (GetExplorerHWND()))
9291 CenterWindow(CWnd::FromHandle(GetExplorerHWND()));
9392
9493 EnableSaveRestore(L"UpdateDlg");
@@ -98,7 +97,7 @@
9897
9998 void CUpdateDlg::OnCancel()
10099 {
101- if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
100+ if (::IsWindow(m_pLogDlg->GetSafeHwnd()) && (m_pLogDlg->IsWindowVisible()))
102101 {
103102 m_pLogDlg->SendMessage(WM_CLOSE);
104103 return;
@@ -112,18 +111,18 @@
112111 if (!UpdateData(TRUE))
113112 return; // don't dismiss dialog (error message already shown by MFC framework)
114113
115- if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
114+ if (::IsWindow(m_pLogDlg->GetSafeHwnd()) && (m_pLogDlg->IsWindowVisible()))
116115 {
117116 m_pLogDlg->SendMessage(WM_CLOSE);
118117 return;
119118 }
120119
121- Revision = SVNRev(m_sRevision);
120+ m_revision = SVNRev(m_sRevision);
122121 if (GetCheckedRadioButton(IDC_REVISION_HEAD, IDC_REVISION_N) == IDC_REVISION_HEAD)
123122 {
124- Revision = SVNRev(L"HEAD");
123+ m_revision = SVNRev(L"HEAD");
125124 }
126- if (!Revision.IsValid())
125+ if (!m_revision.IsValid())
127126 {
128127 ShowEditBalloon(IDC_REVNUM, IDS_ERR_INVALIDREV, IDS_ERR_ERROR, TTI_ERROR);
129128 return;
@@ -130,33 +129,33 @@
130129 }
131130 switch (m_depthCombo.GetCurSel())
132131 {
133- case 0:
134- m_depth = svn_depth_unknown;
135- m_checkoutDepths.clear();
136- break;
137- case 1:
138- m_depth = svn_depth_infinity;
139- m_checkoutDepths.clear();
140- break;
141- case 2:
142- m_depth = svn_depth_immediates;
143- m_checkoutDepths.clear();
144- break;
145- case 3:
146- m_depth = svn_depth_files;
147- m_checkoutDepths.clear();
148- break;
149- case 4:
150- m_depth = svn_depth_empty;
151- m_checkoutDepths.clear();
152- break;
153- case 5:
154- m_depth = svn_depth_exclude;
155- m_checkoutDepths.clear();
156- break;
157- default:
158- m_depth = svn_depth_empty;
159- break;
132+ case 0:
133+ m_depth = svn_depth_unknown;
134+ m_checkoutDepths.clear();
135+ break;
136+ case 1:
137+ m_depth = svn_depth_infinity;
138+ m_checkoutDepths.clear();
139+ break;
140+ case 2:
141+ m_depth = svn_depth_immediates;
142+ m_checkoutDepths.clear();
143+ break;
144+ case 3:
145+ m_depth = svn_depth_files;
146+ m_checkoutDepths.clear();
147+ break;
148+ case 4:
149+ m_depth = svn_depth_empty;
150+ m_checkoutDepths.clear();
151+ break;
152+ case 5:
153+ m_depth = svn_depth_exclude;
154+ m_checkoutDepths.clear();
155+ break;
156+ default:
157+ m_depth = svn_depth_empty;
158+ break;
160159 }
161160
162161 UpdateData(FALSE);
@@ -170,7 +169,7 @@
170169 void CUpdateDlg::OnBnClickedShowLog()
171170 {
172171 UpdateData(TRUE);
173- if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
172+ if (::IsWindow(m_pLogDlg->GetSafeHwnd()) && (m_pLogDlg->IsWindowVisible()))
174173 return;
175174 if (!m_wcPath.IsEmpty())
176175 {
@@ -178,7 +177,7 @@
178177 m_pLogDlg = new CLogDlg();
179178 m_pLogDlg->SetSelect(true);
180179 m_pLogDlg->m_pNotifyWindow = this;
181- m_pLogDlg->m_wParam = 0;
180+ m_pLogDlg->m_wParam = 0;
182181 m_pLogDlg->SetParams(m_wcPath, SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, TRUE);
183182 m_pLogDlg->ContinuousSelection(true);
184183 m_pLogDlg->Create(IDD_LOGMESSAGE, this);
@@ -207,7 +206,7 @@
207206
208207 void CUpdateDlg::OnCbnSelchangeDepth()
209208 {
210- if (m_depthCombo.GetCurSel() == 5) // svn_depth_exclude
209+ if (m_depthCombo.GetCurSel() == 5) // svn_depth_exclude
211210 {
212211 // for exclude depths, the update must be sticky or it will fail
213212 // because it would be a no-op.
@@ -216,17 +215,16 @@
216215 }
217216 }
218217
219-
220218 void CUpdateDlg::OnBnClickedSparse()
221219 {
222220 UpdateData();
223221
224- CString strURLs;
222+ CString strUrLs;
225223
226224 CTSVNPathList paths;
227- paths.LoadFromAsteriskSeparatedString (strURLs);
225+ paths.LoadFromAsteriskSeparatedString(strUrLs);
228226
229- SVN svn;
227+ SVN svn;
230228 CString strUrl = svn.GetURLFromPath(m_wcPath);
231229
232230 CRepositoryBrowser browser(strUrl, SVNRev::REV_HEAD, this);
@@ -233,9 +231,9 @@
233231 browser.SetSparseCheckoutMode(m_wcPath);
234232 if (browser.DoModal() == IDOK)
235233 {
236- m_checkoutDepths = browser.GetUpdateDepths();
234+ m_checkoutDepths = browser.GetUpdateDepths();
237235 CString sCustomDepth = CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_CUSTOM));
238- int customIndex = m_depthCombo.FindStringExact(-1, sCustomDepth);
236+ int customIndex = m_depthCombo.FindStringExact(-1, sCustomDepth);
239237 if (customIndex == CB_ERR)
240238 {
241239 customIndex = m_depthCombo.AddString(sCustomDepth);
--- trunk/src/TortoiseProc/UpdateDlg.h (revision 29180)
+++ trunk/src/TortoiseProc/UpdateDlg.h (revision 29181)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2006, 2009-2012, 2015 - TortoiseSVN
3+// Copyright (C) 2003-2006, 2009-2012, 2015, 2021 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -36,34 +36,37 @@
3636 DECLARE_DYNAMIC(CUpdateDlg)
3737
3838 public:
39- CUpdateDlg(CWnd* pParent = NULL); // standard constructor
40- virtual ~CUpdateDlg();
39+ CUpdateDlg(CWnd* pParent = nullptr); // standard constructor
40+ ~CUpdateDlg() override;
4141
42-// Dialog Data
43- enum { IDD = IDD_UPDATE };
42+ // Dialog Data
43+ enum
44+ {
45+ IDD = IDD_UPDATE
46+ };
4447
4548 protected:
46- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
47- virtual BOOL OnInitDialog();
48- virtual void OnOK();
49- virtual void OnCancel();
50- afx_msg void OnBnClickedShowLog();
49+ void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
50+ BOOL OnInitDialog() override;
51+ void OnOK() override;
52+ void OnCancel() override;
53+ afx_msg void OnBnClickedShowLog();
5154 afx_msg LRESULT OnRevSelected(WPARAM wParam, LPARAM lParam);
52- afx_msg void OnEnChangeRevnum();
53- afx_msg void OnCbnSelchangeDepth();
54- afx_msg void OnBnClickedSparse();
55+ afx_msg void OnEnChangeRevnum();
56+ afx_msg void OnCbnSelchangeDepth();
57+ afx_msg void OnBnClickedSparse();
5558
5659 DECLARE_MESSAGE_MAP()
5760
58- CLogDlg * m_pLogDlg;
59- CString m_sRevision;
60- CComboBox m_depthCombo;
61+ CLogDlg* m_pLogDlg;
62+ CString m_sRevision;
63+ CComboBox m_depthCombo;
6164
6265 public:
63- SVNRev Revision;
64- CTSVNPath m_wcPath;
65- BOOL m_bNoExternals;
66- BOOL m_bStickyDepth;
67- std::map<CString,svn_depth_t> m_checkoutDepths;
68- svn_depth_t m_depth;
66+ SVNRev m_revision;
67+ CTSVNPath m_wcPath;
68+ BOOL m_bNoExternals;
69+ BOOL m_bStickyDepth;
70+ std::map<CString, svn_depth_t> m_checkoutDepths;
71+ svn_depth_t m_depth;
6972 };
Show on old repository browser