From 0ff3f9bff3be1bb4d54c237650b82074e9245daf Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Wed, 27 Aug 2014 21:15:18 +0800 Subject: [PATCH] Fixed issue #2272: Export Dialog auto select tag if the revision has tag Signed-off-by: Sup Yut Sum --- src/Changelog.txt | 3 +++ src/TortoiseProc/AppUtils.cpp | 2 +- src/TortoiseProc/ExportDlg.cpp | 9 +++------ src/TortoiseProc/GitLogListAction.cpp | 9 +++++++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index f29543f64..136abc01f 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -1,6 +1,9 @@ = Release 1.8.12.0 = Released: unreleased +== Features == + * Fixed issue #2272: Export Dialog auto select tag if the revision has tag + == Bug Fixes == * Fixed issue #2260: Clicking in blank space in Commit dialog causes all unversioned files to become selected diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 7982fcd0d..51197471d 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -1012,7 +1012,7 @@ bool CAppUtils::Export(CString *BashHash, const CTGitPath *orgPath) // ask from where the export has to be done CExportDlg dlg; if(BashHash) - dlg.m_Revision=*BashHash; + dlg.m_initialRefName=*BashHash; if (orgPath) { if (PathIsRelative(orgPath->GetWinPath())) diff --git a/src/TortoiseProc/ExportDlg.cpp b/src/TortoiseProc/ExportDlg.cpp index c549d313b..c6ad8def9 100644 --- a/src/TortoiseProc/ExportDlg.cpp +++ b/src/TortoiseProc/ExportDlg.cpp @@ -87,15 +87,12 @@ BOOL CExportDlg::OnInitDialog() CHOOSE_VERSION_ADDANCHOR; this->AddOthersToAnchor(); InitChooseVersion(); - if (m_Revision.IsEmpty() || m_Revision == _T("HEAD")) + if (m_initialRefName.IsEmpty() || m_initialRefName == _T("HEAD")) { SetDefaultChoose(IDC_RADIO_HEAD); } - else - { - SetDefaultChoose(IDC_RADIO_VERSION); - this->GetDlgItem(IDC_COMBOBOXEX_VERSION)->SetWindowTextW(m_Revision); - } + else if (m_initialRefName.Left(10) == _T("refs/tags/")) + SetDefaultChoose(IDC_RADIO_TAGS); CWnd* pHead = GetDlgItem(IDC_RADIO_HEAD); CString headText; diff --git a/src/TortoiseProc/GitLogListAction.cpp b/src/TortoiseProc/GitLogListAction.cpp index 801a01351..2cc5f9e87 100644 --- a/src/TortoiseProc/GitLogListAction.cpp +++ b/src/TortoiseProc/GitLogListAction.cpp @@ -394,6 +394,15 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect, CMe case ID_EXPORT: { CString str=pSelLogEntry->m_CommitHash.ToString(); + // try to get the tag + for (size_t i = 0; i < m_HashMap[pSelLogEntry->m_CommitHash].size(); ++i) + { + if (m_HashMap[pSelLogEntry->m_CommitHash][i].Find(_T("refs/tags/")) == 0) + { + str = m_HashMap[pSelLogEntry->m_CommitHash][i]; + break; + } + } CAppUtils::Export(&str, &m_Path); } break; -- 2.11.4.GIT