From cc0c6e8985e37145c3eea72d222954abc4f3911c Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 28 Aug 2012 08:33:37 +0200 Subject: [PATCH] Allow to start bisect from log dialog Signed-off-by: Sven Strickroth --- src/TortoiseProc/GitLogListAction.cpp | 17 +++++++++++++++++ src/TortoiseProc/GitLogListBase.cpp | 6 ++++++ src/TortoiseProc/GitLogListBase.h | 1 + 3 files changed, 24 insertions(+) diff --git a/src/TortoiseProc/GitLogListAction.cpp b/src/TortoiseProc/GitLogListAction.cpp index 107f9c02b..88f16207d 100644 --- a/src/TortoiseProc/GitLogListAction.cpp +++ b/src/TortoiseProc/GitLogListAction.cpp @@ -807,6 +807,23 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect, CMe CAppUtils::RunTortoiseProc(cmd); } break; + case ID_BISECTSTART: + { + GitRev * first = reinterpret_cast(m_arShownList.GetAt(FirstSelect)); + GitRev * last = reinterpret_cast(m_arShownList.GetAt(LastSelect)); + ASSERT(first != NULL && last != NULL); + + CString firstBad = first->m_CommitHash.ToString(); + if (!m_HashMap[first->m_CommitHash].empty()) + firstBad = m_HashMap[first->m_CommitHash].at(0); + CString lastGood = last->m_CommitHash.ToString(); + if (!m_HashMap[last->m_CommitHash].empty()) + lastGood = m_HashMap[last->m_CommitHash].at(0); + + if (CAppUtils::BisectStart(lastGood, firstBad)) + Refresh(); + } + break; case ID_REPOBROWSE: { CString sCmd; diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 8b5867f03..3885cbcdb 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -1782,6 +1782,12 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point) popup.AppendMenu(MF_SEPARATOR, NULL); } + if (m_hasWC && (m_ContextMenuMask & GetContextMenuBit(ID_BISECTSTART)) && GetSelectedCount() == 2 && !reinterpret_cast(m_arShownList.SafeGetAt(FirstSelect))->m_CommitHash.IsEmpty() && !CTGitPath(g_Git.m_CurrentDir).IsBisectActive()) + { + popup.AppendMenuIcon(ID_BISECTSTART, IDS_MENUBISECTSTART); + popup.AppendMenu(MF_SEPARATOR, NULL); + } + if (GetSelectedCount() == 1) { bool bAddSeparator = false; diff --git a/src/TortoiseProc/GitLogListBase.h b/src/TortoiseProc/GitLogListBase.h index 073b5734b..bde93cb62 100644 --- a/src/TortoiseProc/GitLogListBase.h +++ b/src/TortoiseProc/GitLogListBase.h @@ -274,6 +274,7 @@ public: ID_FETCH, ID_SHOWBRANCHES, ID_COPYCLIPBOARDMESSAGES, + ID_BISECTSTART, }; enum { -- 2.11.4.GIT