• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28711 (tree)
Time2020-01-09 04:38:49
Authorstefankueng

Log Message

Allow to delete a shelf
* add button to delete a shelf to the unshelve dialog
* implement the DropShelf() methon in the SVN class
* use separate SVN objects instead of a dialog-global one, since the shelf-db isn't released when the scratch memory pools are cleared

Change Summary

Incremental Difference

--- trunk/src/SVN/SVN.cpp (revision 28710)
+++ trunk/src/SVN/SVN.cpp (revision 28711)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2019 - TortoiseSVN
3+// Copyright (C) 2003-2020 - 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
@@ -483,6 +483,22 @@
483483 return (Err == nullptr);
484484 }
485485
486+bool SVN::DropShelf(const CString& shelveName, const CTSVNPath& local_abspath)
487+{
488+ SVNPool subpool(m_pool);
489+
490+ Prepare();
491+
492+ SVNTRACE(
493+ Err = svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
494+ local_abspath.GetSVNApiPath(subpool),
495+ false,
496+ m_pctx, subpool),
497+ NULL);
498+
499+ return (Err == nullptr);
500+}
501+
486502 bool SVN::Checkout(const CTSVNPath& moduleName, const CTSVNPath& destPath, const SVNRev& pegrev,
487503 const SVNRev& revision, svn_depth_t depth, bool bIgnoreExternals,
488504 bool bAllow_unver_obstructions)
--- trunk/src/SVN/SVN.h (revision 28710)
+++ trunk/src/SVN/SVN.h (revision 28711)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2019 - TortoiseSVN
3+// Copyright (C) 2003-2020 - 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
@@ -161,6 +161,7 @@
161161 bool Unshelve(const CString& shelveName, int version, const CTSVNPath &local_abspath);
162162 ShelfInfo GetShelfInfo(const CString& shelfName, const CTSVNPath& local_abspath);
163163 bool ShelvesList(std::vector<CString>& Names, const CTSVNPath &local_abspath);
164+ bool DropShelf(const CString& shelveName, const CTSVNPath& local_abspath);
164165
165166 /**
166167 * Checkout a working copy of moduleName at revision, using destPath as the root
--- trunk/src/TortoiseProc/UnshelveDlg.cpp (revision 28710)
+++ trunk/src/TortoiseProc/UnshelveDlg.cpp (revision 28711)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2017-2019 - TortoiseSVN
3+// Copyright (C) 2017-2020 - 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
@@ -31,6 +31,7 @@
3131 : CResizableStandAloneDialog(CUnshelve::IDD, pParent)
3232 , m_nIconFolder(0)
3333 , m_Version(-1)
34+ , m_columnbuf{ 0 }
3435 {
3536 }
3637
@@ -52,6 +53,7 @@
5253 ON_CBN_SELCHANGE(IDC_SHELVENAME, &CUnshelve::OnCbnSelchangeShelvename)
5354 ON_CBN_SELCHANGE(IDC_VERSIONCOMBO, &CUnshelve::OnCbnSelchangeVersioncombo)
5455 ON_NOTIFY(LVN_GETDISPINFO, IDC_FILELIST, &CUnshelve::OnLvnGetdispinfoFilelist)
56+ ON_BN_CLICKED(IDC_DELETE, &CUnshelve::OnBnClickedDelete)
5557 END_MESSAGE_MAP()
5658
5759 BOOL CUnshelve::OnInitDialog()
@@ -94,7 +96,8 @@
9496 m_cFileList.SetRedraw(true);
9597
9698 std::vector<CString> Names;
97- m_svn.ShelvesList(Names, m_pathList.GetCommonRoot());
99+ SVN svn;
100+ svn.ShelvesList(Names, m_pathList.GetCommonRoot());
98101 for (const auto& name : Names)
99102 {
100103 m_cShelvesCombo.AddString(name);
@@ -112,6 +115,7 @@
112115 AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, TOP_RIGHT);
113116 AddAnchor(IDC_FILESLABEL, TOP_LEFT);
114117 AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT);
118+ AddAnchor(IDC_DELETE, BOTTOM_LEFT);
115119 AddAnchor(IDOK, BOTTOM_RIGHT);
116120 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
117121 AddAnchor(IDHELP, BOTTOM_RIGHT);
@@ -156,7 +160,8 @@
156160 CString shelfName;
157161 m_cShelvesCombo.GetLBText(sel, shelfName);
158162 // get the info for the selected shelf
159- m_currentShelfInfo = m_svn.GetShelfInfo(shelfName, m_pathList.GetCommonRoot());
163+ SVN svn;
164+ m_currentShelfInfo = svn.GetShelfInfo(shelfName, m_pathList.GetCommonRoot());
160165 m_cLogMessage.SetText(m_currentShelfInfo.LogMessage);
161166 int v = 0;
162167 m_cVersionCombo.ResetContent();
@@ -248,3 +253,28 @@
248253 }
249254 *pResult = 0;
250255 }
256+
257+
258+void CUnshelve::OnBnClickedDelete()
259+{
260+ int selectedName = m_cShelvesCombo.GetCurSel();
261+ if (selectedName >= 0)
262+ {
263+ m_cShelvesCombo.GetLBText(selectedName, m_sShelveName);
264+ SVN svn;
265+ if (!svn.DropShelf(m_sShelveName, m_pathList.GetCommonRoot()))
266+ {
267+ svn.ShowErrorDialog(GetSafeHwnd(), m_pathList.GetCommonRoot());
268+ }
269+
270+ m_cShelvesCombo.ResetContent();
271+ std::vector<CString> Names;
272+ svn.ShelvesList(Names, m_pathList.GetCommonRoot());
273+ for (const auto& name : Names)
274+ {
275+ m_cShelvesCombo.AddString(name);
276+ }
277+ m_cShelvesCombo.SetCurSel(0);
278+ OnCbnSelchangeShelvename();
279+ }
280+}
--- trunk/src/TortoiseProc/UnshelveDlg.h (revision 28710)
+++ trunk/src/TortoiseProc/UnshelveDlg.h (revision 28711)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2017-2018 - TortoiseSVN
3+// Copyright (C) 2017-2018, 2020 - 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
@@ -45,6 +45,7 @@
4545 virtual void OnCancel();
4646 virtual void OnOK();
4747 afx_msg void OnBnClickedHelp();
48+ afx_msg void OnBnClickedDelete();
4849 afx_msg void OnCbnSelchangeShelvename();
4950 afx_msg void OnCbnSelchangeVersioncombo();
5051 afx_msg void OnLvnGetdispinfoFilelist(NMHDR* pNMHDR, LRESULT* pResult);
@@ -52,7 +53,6 @@
5253 DECLARE_MESSAGE_MAP()
5354
5455 private:
55- SVN m_svn;
5656 CComboBox m_cShelvesCombo;
5757 CComboBox m_cVersionCombo;
5858 CListCtrl m_cFileList;
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Show on old repository browser