}else\r
{\r
// set the log message text\r
- pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n*")+pLogEntry->m_Subject+_T("\n\n")+pLogEntry->m_Body);\r
+ pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n* ")+pLogEntry->m_Subject+_T("\n\n")+pLogEntry->m_Body);\r
// turn bug ID's into links if the bugtraq: properties have been set\r
// and we can find a match of those in the log message\r
- m_ProjectProperties.FindBugID(pLogEntry->m_Body, pMsgView);\r
+\r
+ CString text;\r
+ pMsgView->GetWindowText(text);\r
+ // the rich edit control doesn't count the CR char!\r
+ // to be exact: CRLF is treated as one char.\r
+ text.Replace(_T("\r"), _T(""));\r
+\r
+ m_ProjectProperties.FindBugID(text, pMsgView);\r
CAppUtils::FormatTextInRichEditControl(pMsgView);\r
\r
int HidePaths=m_cHidePaths.GetState() & 0x0003;\r
-// TortoiseGit - a Windows shell extension for easy version control\r
+// TortoiseSVN - a Windows shell extension for easy version control\r
\r
// Copyright (C) 2003-2008 - TortoiseGit\r
\r
\r
GetStringProps(this->sLabel,BUGTRAQPROPNAME_LABEL);\r
GetStringProps(this->sMessage,BUGTRAQPROPNAME_MESSAGE);\r
+ GetStringProps(this->sUrl,BUGTRAQPROPNAME_URL);\r
\r
GetBOOLProps(this->bWarnIfNoIssue,BUGTRAQPROPNAME_WARNIFNOISSUE);\r
GetBOOLProps(this->bNumber,BUGTRAQPROPNAME_NUMBER);\r
{\r
ATLTRACE(_T("matched id : %s\n"), (*it2)[0].str().c_str());\r
ptrdiff_t matchposID = it2->position(0);\r
- CHARRANGE range = {matchpos+matchposID, matchpos+matchposID+(*it2)[0].str().size()};\r
+ CHARRANGE range = {(LONG)(matchpos+matchposID), (LONG)(matchpos+matchposID+(*it2)[0].str().size())};\r
pWnd->SendMessage(EM_EXSETSEL, NULL, (LPARAM)&range);\r
CHARFORMAT2 format;\r
SecureZeroMemory(&format, sizeof(CHARFORMAT2));\r
if (match.size() >= 2)\r
{\r
ATLTRACE(_T("matched id : %s\n"), wstring(match[1]).c_str());\r
- CHARRANGE range = {match[1].first-s.begin(), match[1].second-s.begin()};\r
+ CHARRANGE range = {(LONG)(match[1].first-s.begin()), (LONG)(match[1].second-s.begin())};\r
pWnd->SendMessage(EM_EXSETSEL, NULL, (LPARAM)&range);\r
CHARFORMAT2 format;\r
SecureZeroMemory(&format, sizeof(CHARFORMAT2));\r
return FALSE;\r
}\r
\r
-CString ProjectProperties::FindBugID(const CString& msg)\r
+std::set<CString> ProjectProperties::FindBugIDs(const CString& msg)\r
{\r
size_t offset1 = 0;\r
size_t offset2 = 0;\r
bool bFound = false;\r
-\r
- CString sRet;\r
-\r
std::set<CString> bugIDs;\r
\r
// first use the checkre string to find bug ID's in the message\r
CString sLastPart;\r
BOOL bTop = FALSE;\r
if (sMessage.Find(_T("%BUGID%"))<0)\r
- goto finish;\r
+ return bugIDs;\r
sFirstPart = sMessage.Left(sMessage.Find(_T("%BUGID%")));\r
sLastPart = sMessage.Mid(sMessage.Find(_T("%BUGID%"))+7);\r
CString sMsg = msg;\r
bTop = TRUE;\r
}\r
if (sBugLine.IsEmpty())\r
- goto finish;\r
+ return bugIDs;\r
CString sBugIDPart = sBugLine.Mid(sFirstPart.GetLength(), sBugLine.GetLength() - sFirstPart.GetLength() - sLastPart.GetLength());\r
if (sBugIDPart.IsEmpty())\r
- goto finish;\r
+ return bugIDs;\r
//the bug id part can contain several bug id's, separated by commas\r
if (!bTop)\r
offset1 = sMsg.GetLength() - sBugLine.GetLength() + sFirstPart.GetLength();\r
CHARRANGE range = {(LONG)offset1, (LONG)offset2};\r
bugIDs.insert(msg.Mid(range.cpMin, range.cpMax-range.cpMin));\r
}\r
-finish:\r
+\r
+ return bugIDs;\r
+}\r
+\r
+CString ProjectProperties::FindBugID(const CString& msg)\r
+{\r
+ CString sRet;\r
+\r
+ std::set<CString> bugIDs = FindBugIDs(msg);\r
+\r
for (std::set<CString>::iterator it = bugIDs.begin(); it != bugIDs.end(); ++it)\r
{\r
sRet += *it;\r
return sRet;\r
}\r
\r
+CString ProjectProperties::MakeShortMessage(const CString& message)\r
+{\r
+ bool bFoundShort = true;\r
+ CString sShortMessage = GetLogSummary(message);\r
+ if (sShortMessage.IsEmpty())\r
+ {\r
+ bFoundShort = false;\r
+ sShortMessage = message;\r
+ }\r
+ // Remove newlines and tabs 'cause those are not shown nicely in the list control\r
+ sShortMessage.Replace(_T("\r"), _T(""));\r
+ sShortMessage.Replace(_T("\t"), _T(" "));\r
+ \r
+ // Suppose the first empty line separates 'summary' from the rest of the message.\r
+ int found = sShortMessage.Find(_T("\n\n"));\r
+ // To avoid too short 'short' messages \r
+ // (e.g. if the message looks something like "Bugfix:\n\n*done this\n*done that")\r
+ // only use the empty newline as a separator if it comes after at least 15 chars.\r
+ if ((!bFoundShort)&&(found >= 15))\r
+ {\r
+ sShortMessage = sShortMessage.Left(found);\r
+ }\r
+ sShortMessage.Replace('\n', ' ');\r
+ return sShortMessage;\r
+}\r
+\r
#ifdef DEBUG\r
static class PropTest\r
{\r
BOOL FindBugID(const CString& msg, CWnd * pWnd);\r
\r
CString FindBugID(const CString& msg);\r
+ std::set<CString> FindBugIDs(const CString& msg);\r
/**\r
* Searches for the BugID inside a log message. If one is found,\r
* that BugID is returned. If none is found, an empty string is returned.\r
*/\r
CString GetLogSummary(const CString& sMessage);\r
\r
+ /**\r
+ * Transform the log message using \ref GetLogSummary and post-process it\r
+ * to be suitable for 1-line controls.\r
+ */\r
+ CString MakeShortMessage(const CString& message);\r
+\r
/**\r
* Returns the path from which the properties were read.\r
*/\r
log message instead of at the bottom. Default is TRUE */\r
BOOL bAppend;\r
\r
+ /** the COM uuid of the bugtraq provider which implements the IBugTraqProvider\r
+ interface. */\r
+ CString sProviderUuid;\r
+\r
+ /** the parameters passed to the COM bugtraq provider which implements the\r
+ IBugTraqProvider interface */\r
+ CString sProviderParams;\r
+\r
/** The number of chars the width marker should be shown at. If the property\r
* is not set, then this value is 80 by default. */\r
int nLogWidthMarker;\r
* is the first matching regex group.\r
*/\r
CString sLogSummaryRe;\r
+\r
+ /**\r
+ * A regex string to extract revisions from a log message.\r
+ */\r
+ CString sLogRevRegex;\r
private:\r
CString sAutoProps;\r
CTGitPath propsPath;\r