From 1536ac0a74d000fd7fc518b344cceb5bfb2be3a3 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Thu, 31 Jan 2013 22:42:54 +0100 Subject: [PATCH] Fixed issue #1623: Search by email in Log window Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/Resources/TortoiseProcENG.rc | 1 + src/TortoiseProc/GitLogListBase.cpp | 41 +++++++++++++++++++++++++++++++++++++ src/TortoiseProc/GitLogListBase.h | 1 + src/TortoiseProc/LogDlg.cpp | 3 +++ src/TortoiseProc/resource.h | 1 + 6 files changed, 48 insertions(+) diff --git a/src/Changelog.txt b/src/Changelog.txt index 208efeb3c..8fa96027b 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -5,6 +5,7 @@ Released: unreleased * Log dialog can revert selected files to parent revision * Fixed issue #1500: Support git merge --log option * Can disable log cache (tortoisegit.data, tortoisegit.index) + * Fixed issue #1623: Search by email in Log window == Bug Fix == * Fixed issue #1611: Changing Search criteria with empty search field refreshes log content diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 08559d395..3e9c9f0e0 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -3945,6 +3945,7 @@ BEGIN IDS_PROC_BROWSEREFS_DELETEALLTAGS "Delete all tags" IDS_SETTINGS_ENABLELOGCACHE_TT "Enable loading/saving log cache files (tortoisegit.data, tortoisegit.index)" + IDS_LOG_FILTER_EMAILS "Emails" END #endif // English (U.S.) resources diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 7ac9801b2..3ac2b54ca 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -2862,6 +2862,19 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRev *pRev, tr1::wregex &pat) } } + if (m_SelectedFilters & LOGFILTER_EMAILS) + { + if (regex_search(wstring(pRev->GetAuthorEmail()), pat, flags)) + { + return TRUE; + } + + if (regex_search(wstring(pRev->GetCommitterEmail()), pat, flags)) + { + return TRUE; + } + } + if (m_SelectedFilters & LOGFILTER_REVS) { sRev.Format(_T("%s"), pRev->m_CommitHash.ToString()); @@ -2967,6 +2980,16 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRev *pRev, tr1::wregex &pat) } } + if (m_SelectedFilters & LOGFILTER_EMAILS) + { + CString msg = pRev->GetAuthorEmail(); + msg = msg.MakeLower(); + if ((msg.Find(find) >= 0)) + { + return TRUE; + } + } + if (m_SelectedFilters & LOGFILTER_REVS) { sRev.Format(_T("%s"), pRev->m_CommitHash.ToString()); @@ -3112,6 +3135,14 @@ void CGitLogListBase::RecalculateShownList(CThreadSafePtrArray * pShownlist) continue; } } + if (m_SelectedFilters & LOGFILTER_EMAILS) + { + if (regex_search(wstring((LPCTSTR)m_logEntries.GetGitRevAt(i).GetAuthorEmail()), pat, flags) && IsEntryInDateRange(i)) + { + pShownlist->SafeAdd(&m_logEntries.GetGitRevAt(i)); + continue; + } + } if (m_SelectedFilters & LOGFILTER_REVS) { sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash.ToString()); @@ -3217,6 +3248,16 @@ void CGitLogListBase::RecalculateShownList(CThreadSafePtrArray * pShownlist) continue; } } + if (m_SelectedFilters & LOGFILTER_EMAILS) + { + CString msg = m_logEntries.GetGitRevAt(i).GetAuthorEmail(); + msg = msg.MakeLower(); + if ((msg.Find(find) >= 0) && (IsEntryInDateRange(i))) + { + pShownlist->SafeAdd(&m_logEntries.GetGitRevAt(i)); + continue; + } + } if (m_SelectedFilters & LOGFILTER_REVS) { sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash.ToString()); diff --git a/src/TortoiseProc/GitLogListBase.h b/src/TortoiseProc/GitLogListBase.h index c398928b4..5ef0e8233 100644 --- a/src/TortoiseProc/GitLogListBase.h +++ b/src/TortoiseProc/GitLogListBase.h @@ -77,6 +77,7 @@ enum LISTITEMSTATES_MINE { #define LOGFILTER_BUGID 0x0020 #define LOGFILTER_SUBJECT 0x0040 #define LOGFILTER_REFNAME 0x0080 +#define LOGFILTER_EMAILS 0x0100 #define LOGLIST_SHOWNOREFS 0x0000 #define LOGLIST_SHOWLOCALBRANCHES 0x0001 diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index fdb2e7822..4bac6721b 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -1353,6 +1353,9 @@ LRESULT CLogDlg::OnClickedInfoIcon(WPARAM /*wParam*/, LPARAM lParam) temp.LoadString(IDS_LOG_FILTER_AUTHORS); popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_AUTHORS), LOGFILTER_AUTHORS, temp); + temp.LoadString(IDS_LOG_FILTER_EMAILS); + popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_EMAILS), LOGFILTER_EMAILS, temp); + temp.LoadString(IDS_LOG_FILTER_REVS); popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_REVS), LOGFILTER_REVS, temp); diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index e3503720e..472e58188 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -862,6 +862,7 @@ #define IDC_FILTER 1387 #define IDS_PROC_BROWSEREFS_DELETEALLTAGS 1387 #define IDS_SETTINGS_ENABLELOGCACHE_TT 1388 +#define IDS_LOG_FILTER_EMAILS 1389 #define IDC_REVISIONGROUP 1393 #define IDC_REPOLABEL 1394 #define IDS_WARN_FOLDERNOTEXIST 1400 -- 2.11.4.GIT