Fixed issue #1623: Search by email in Log window
authorSven Strickroth <email@cs-ware.de>
Thu, 31 Jan 2013 21:42:54 +0000 (31 22:42 +0100)
committerSven Strickroth <email@cs-ware.de>
Thu, 31 Jan 2013 21:42:54 +0000 (31 22:42 +0100)
Signed-off-by: Sven Strickroth <email@cs-ware.de>
src/Changelog.txt
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h
src/TortoiseProc/LogDlg.cpp
src/TortoiseProc/resource.h

index 208efeb..8fa9602 100644 (file)
@@ -5,6 +5,7 @@ Released: unreleased
  * Log dialog can revert selected files to parent revision\r
  * Fixed issue #1500: Support git merge --log option\r
  * Can disable log cache (tortoisegit.data, tortoisegit.index)\r
+ * Fixed issue #1623: Search by email in Log window\r
 \r
 == Bug Fix ==\r
  * Fixed issue #1611: Changing Search criteria with empty search field refreshes log content\r
index 08559d3..3e9c9f0 100644 (file)
@@ -3945,6 +3945,7 @@ BEGIN
     IDS_PROC_BROWSEREFS_DELETEALLTAGS "Delete all tags"\r
     IDS_SETTINGS_ENABLELOGCACHE_TT \r
                             "Enable loading/saving log cache files (tortoisegit.data, tortoisegit.index)"\r
+    IDS_LOG_FILTER_EMAILS   "Emails"\r
 END\r
 \r
 #endif    // English (U.S.) resources\r
index 7ac9801..3ac2b54 100644 (file)
@@ -2862,6 +2862,19 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRev *pRev, tr1::wregex &pat)
                        }\r
                }\r
 \r
+               if (m_SelectedFilters & LOGFILTER_EMAILS)\r
+               {\r
+                       if (regex_search(wstring(pRev->GetAuthorEmail()), pat, flags))\r
+                       {\r
+                               return TRUE;\r
+                       }\r
+\r
+                       if (regex_search(wstring(pRev->GetCommitterEmail()), pat, flags))\r
+                       {\r
+                               return TRUE;\r
+                       }\r
+               }\r
+\r
                if (m_SelectedFilters & LOGFILTER_REVS)\r
                {\r
                        sRev.Format(_T("%s"), pRev->m_CommitHash.ToString());\r
@@ -2967,6 +2980,16 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRev *pRev, tr1::wregex &pat)
                        }\r
                }\r
 \r
+               if (m_SelectedFilters & LOGFILTER_EMAILS)\r
+               {\r
+                       CString msg = pRev->GetAuthorEmail();\r
+                       msg = msg.MakeLower();\r
+                       if ((msg.Find(find) >= 0))\r
+                       {\r
+                               return TRUE;\r
+                       }\r
+               }\r
+\r
                if (m_SelectedFilters & LOGFILTER_REVS)\r
                {\r
                        sRev.Format(_T("%s"), pRev->m_CommitHash.ToString());\r
@@ -3112,6 +3135,14 @@ void CGitLogListBase::RecalculateShownList(CThreadSafePtrArray * pShownlist)
                                        continue;\r
                                }\r
                        }\r
+                       if (m_SelectedFilters & LOGFILTER_EMAILS)\r
+                       {\r
+                               if (regex_search(wstring((LPCTSTR)m_logEntries.GetGitRevAt(i).GetAuthorEmail()), pat, flags) && IsEntryInDateRange(i))\r
+                               {\r
+                                       pShownlist->SafeAdd(&m_logEntries.GetGitRevAt(i));\r
+                                       continue;\r
+                               }\r
+                       }\r
                        if (m_SelectedFilters & LOGFILTER_REVS)\r
                        {\r
                                sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash.ToString());\r
@@ -3217,6 +3248,16 @@ void CGitLogListBase::RecalculateShownList(CThreadSafePtrArray * pShownlist)
                                        continue;\r
                                }\r
                        }\r
+                       if (m_SelectedFilters & LOGFILTER_EMAILS)\r
+                       {\r
+                               CString msg = m_logEntries.GetGitRevAt(i).GetAuthorEmail();\r
+                               msg = msg.MakeLower();\r
+                               if ((msg.Find(find) >= 0) && (IsEntryInDateRange(i)))\r
+                               {\r
+                                       pShownlist->SafeAdd(&m_logEntries.GetGitRevAt(i));\r
+                                       continue;\r
+                               }\r
+                       }\r
                        if (m_SelectedFilters & LOGFILTER_REVS)\r
                        {\r
                                sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash.ToString());\r
index c398928..5ef0e82 100644 (file)
@@ -77,6 +77,7 @@ enum LISTITEMSTATES_MINE {
 #define LOGFILTER_BUGID                        0x0020\r
 #define LOGFILTER_SUBJECT              0x0040\r
 #define LOGFILTER_REFNAME              0x0080\r
+#define LOGFILTER_EMAILS               0x0100\r
 \r
 #define LOGLIST_SHOWNOREFS                     0x0000\r
 #define LOGLIST_SHOWLOCALBRANCHES      0x0001\r
index fdb2e78..4bac672 100644 (file)
@@ -1353,6 +1353,9 @@ LRESULT CLogDlg::OnClickedInfoIcon(WPARAM /*wParam*/, LPARAM lParam)
                temp.LoadString(IDS_LOG_FILTER_AUTHORS);\r
                popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_AUTHORS), LOGFILTER_AUTHORS, temp);\r
 \r
+               temp.LoadString(IDS_LOG_FILTER_EMAILS);\r
+               popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_EMAILS), LOGFILTER_EMAILS, temp);\r
+\r
                temp.LoadString(IDS_LOG_FILTER_REVS);\r
                popup.AppendMenu(LOGMENUFLAGS(LOGFILTER_REVS), LOGFILTER_REVS, temp);\r
 \r
index e350372..472e581 100644 (file)
 #define IDC_FILTER                      1387\r
 #define IDS_PROC_BROWSEREFS_DELETEALLTAGS 1387\r
 #define IDS_SETTINGS_ENABLELOGCACHE_TT  1388\r
+#define IDS_LOG_FILTER_EMAILS           1389\r
 #define IDC_REVISIONGROUP               1393\r
 #define IDC_REPOLABEL                   1394\r
 #define IDS_WARN_FOLDERNOTEXIST         1400\r