From a450e72a2a0e46a3c2a95046a9f948bee2e3261b Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 16 Oct 2018 10:05:58 +0200 Subject: [PATCH] Fixed issue #3272: Revision Graph does not show the option to checkout a remote branch Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + .../RevisionGraph/RevisionGraphWnd.cpp | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/Changelog.txt b/src/Changelog.txt index 4badaaa74..e4bc80ea1 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -9,6 +9,7 @@ Released: unreleased * Update Scintilla to 4.1.2 * Fixed issue #3277: Start of rebase process doesn't show log tab by default * Fixed issue #3273: Show more information (beginning of commit subject) about commit parents in context menus + * Fixed issue #3272: Revision Graph does not show the option to checkout a remote branch == Bug Fixes == * Fixed issue #3250: GitWCRev: IsGitItem return true for item that had never been committed diff --git a/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp b/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp index 556a1fb0c..fbcb1274f 100644 --- a/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp +++ b/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp @@ -73,6 +73,7 @@ enum RevisionGraphContextMenuCommands ID_SWITCHTOHEAD, ID_SWITCH, ID_DELETE, + ID_SWITCHTOREV, ID_COPYREFS = 0x400, ID_EXPAND_ALL = 0x500, ID_JOIN_ALL, @@ -1433,6 +1434,7 @@ void CRevisionGraphWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point) STRING_VECTOR branchNames; STRING_VECTOR allRefNames; + STRING_VECTOR remoteBranchNames; if (m_SelectedEntry1 && (m_SelectedEntry2 == nullptr)) { AppendMenu(popup, IDS_LOG_BROWSEREPO, ID_BROWSEREPO); @@ -1454,6 +1456,17 @@ void CRevisionGraphWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point) AppendMenu(switchMenu, branchNames[i], ID_SWITCH + ((int)(i + 1) << 16), &branchNames[i]); AppendMenu(popup, CString(MAKEINTRESOURCE(IDS_SWITCH_BRANCH)), ID_SWITCH, nullptr, &switchMenu); } + else + { + CGit::REF_TYPE remoteRefType = CGit::REMOTE_BRANCH; + remoteBranchNames = GetFriendRefNames(m_SelectedEntry1, ¤tBranch, &remoteRefType); + if (remoteBranchNames.size() >= 1) + { + CString temp; + temp.LoadString(IDS_SWITCH_TO_THIS); + AppendMenu(popup, temp, ID_SWITCHTOREV, &remoteBranchNames[0]); + } + } AppendMenu(popup, IDS_COPY_REF_NAMES, ID_COPYREFS); @@ -1537,6 +1550,17 @@ void CRevisionGraphWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point) } break; } + case ID_SWITCHTOREV: + { + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); + mii.fMask |= MIIM_DATA; + GetMenuItemInfo(popup, cmd, FALSE, &mii); + CString* rev = (CString*)mii.dwItemData; + CAppUtils::Switch(GetSafeHwnd(), *rev); + m_parent->UpdateFullHistory(); + } + break; case ID_COPYREFS: DoCopyRefs(); break; -- 2.11.4.GIT