HRESULT GetCommitMessage2 (\r
[in] HWND hParentWnd, // Parent window for your provider's UI.\r
[in] BSTR parameters, // Parameters for your provider.\r
- [in] BSTR commonURL, // the common url of the commit\r
+ [in] BSTR commonURL, // the common url of all items in the commit dialog (checked or unchecked!), \r
+ // with the url of the item that was selected to bring up the commit dialog having precedence.\r
[in] BSTR commonRoot,\r
[in] SAFEARRAY(BSTR) pathList,\r
[in] BSTR originalMessage, // The text already present in the commit message.\r
// Your provider should include this text in the new message, where appropriate.\r
- [out, retval] BSTR *newMessage // The new text for the commit message. This replaces the original message.\r
+ // you can assign custom revision properties to a commit by setting the next two params.\r
+ // note: both safearrays must be of the same length. For every property name there must be a property value!\r
+ [in] BSTR bugID, // the content of the bugID field (if shown)\r
+ [out] BSTR * bugIDOut, // modified content of the bugID field\r
+ [out] SAFEARRAY(BSTR) * revPropNames, // a list of revision property names which are applied to the commit\r
+ [out] SAFEARRAY(BSTR) * revPropValues, // a list of revision property values which are applied to the commit\r
+ [out, retval] BSTR * newMessage // The new text for the commit message. This replaces the original message.\r
); \r
\r
+ /** Called right before the commit dialog is dismissed. This is the last chance to reject\r
+ * a commit. You can check the commit log message here and return an error message if it does not\r
+ * match your specification. An empty error string means the commit is allowed.\r
+ */\r
+ HRESULT CheckCommit (\r
+ [in] HWND hParentWnd,\r
+ [in] BSTR parameters,\r
+ [in] BSTR commonURL,\r
+ [in] BSTR commonRoot,\r
+ [in] SAFEARRAY(BSTR) pathList,\r
+ [in] BSTR commitMessage,\r
+ [out, retval] BSTR * errorMessage\r
+ );\r
+\r
HRESULT OnCommitFinished (\r
[in] HWND hParentWnd, // Parent window for any (error) UI that needs to be displayed.\r
[in] BSTR commonRoot, // The common root of all paths that got committed.\r
#include "CommitDlg.h"\r
#include "DirFileEnum.h"\r
//#include "GitConfig.h"\r
-//#include "GitProperties.h"\r
+#include "ProjectProperties.h"\r
#include "MessageBox.h"\r
#include "AppUtils.h"\r
#include "PathUtils.h"\r
ON_STN_CLICKED(IDC_COMMITLABEL, &CCommitDlg::OnStnClickedCommitlabel)\r
ON_BN_CLICKED(IDC_COMMIT_AMEND, &CCommitDlg::OnBnClickedCommitAmend)\r
ON_BN_CLICKED(IDC_WHOLE_PROJECT, &CCommitDlg::OnBnClickedWholeProject)\r
+ ON_STN_CLICKED(IDC_BUGIDLABEL, &CCommitDlg::OnStnClickedBugidlabel)\r
END_MESSAGE_MAP()\r
\r
BOOL CCommitDlg::OnInitDialog()\r
m_ListCtrl.SetBackgroundImage(IDI_COMMIT_BKG);\r
\r
//this->DialogEnableWindow(IDC_COMMIT_AMEND,FALSE);\r
-// m_ProjectProperties.ReadPropsPathList(m_pathList);\r
+ m_ProjectProperties.ReadPropsPathList(m_pathList);\r
+\r
m_cLogMessage.Init(m_ProjectProperties);\r
m_cLogMessage.SetFont((CString)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));\r
m_cLogMessage.RegisterContextMenuHandler(this);\r
\r
m_SelectAll.SetCheck(BST_INDETERMINATE);\r
\r
-#if 0\r
+\r
CBugTraqAssociations bugtraq_associations;\r
bugtraq_associations.Load();\r
\r
- if (bugtraq_associations.FindProvider(m_pathList, &m_bugtraq_association))\r
+ if (bugtraq_associations.FindProvider(g_Git.m_CurrentDir, &m_bugtraq_association))\r
{\r
GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);\r
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);\r
}\r
}\r
else\r
-#endif\r
{\r
GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);\r
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);\r
\r
void CCommitDlg::OnBnClickedBugtraqbutton()\r
{\r
-#if 0\r
m_tooltips.Pop(); // hide the tooltips\r
CString sMsg = m_cLogMessage.GetText();\r
\r
return;\r
\r
BSTR parameters = m_bugtraq_association.GetParameters().AllocSysString();\r
- BSTR commonRoot = SysAllocString(m_pathList.GetCommonRoot().GetDirectory().GetWinPath());\r
+ BSTR commonRoot = SysAllocString(g_Git.m_CurrentDir);\r
SAFEARRAY *pathList = SafeArrayCreateVector(VT_BSTR, 0, m_pathList.GetCount());\r
\r
for (LONG index = 0; index < m_pathList.GetCount(); ++index)\r
\r
BSTR originalMessage = sMsg.AllocSysString();\r
BSTR temp = NULL;\r
+// m_revProps.clear();\r
\r
// first try the IBugTraqProvider2 interface\r
CComPtr<IBugTraqProvider2> pProvider2 = NULL;\r
HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider2);\r
if (SUCCEEDED(hr))\r
{\r
- CString common = m_ListCtrl.GetCommonURL(false).GetGitPathString();\r
- BSTR repositoryRoot = common.AllocSysString();\r
- if (FAILED(hr = pProvider2->GetCommitMessage2(GetSafeHwnd(), parameters, repositoryRoot, commonRoot, pathList, originalMessage, &temp)))\r
+ //CString common = m_ListCtrl.GetCommonURL(false).GetGitPathString();\r
+ BSTR repositoryRoot = g_Git.m_CurrentDir.AllocSysString();\r
+ BSTR bugIDOut = NULL;\r
+ GetDlgItemText(IDC_BUGID, m_sBugID);\r
+ BSTR bugID = m_sBugID.AllocSysString();\r
+ SAFEARRAY * revPropNames = NULL;\r
+ SAFEARRAY * revPropValues = NULL;\r
+ if (FAILED(hr = pProvider2->GetCommitMessage2(GetSafeHwnd(), parameters, repositoryRoot, commonRoot, pathList, originalMessage, bugID, &bugIDOut, &revPropNames, &revPropValues, &temp)))\r
{\r
CString sErr;\r
sErr.Format(IDS_ERR_FAILEDISSUETRACKERCOM, m_bugtraq_association.GetProviderName(), _com_error(hr).ErrorMessage());\r
CMessageBox::Show(m_hWnd, sErr, _T("TortoiseGit"), MB_ICONERROR);\r
}\r
else\r
+ {\r
+ if (bugIDOut)\r
+ {\r
+ m_sBugID = bugIDOut;\r
+ SysFreeString(bugIDOut);\r
+ SetDlgItemText(IDC_BUGID, m_sBugID);\r
+ }\r
+ SysFreeString(bugID);\r
+ SysFreeString(repositoryRoot);\r
m_cLogMessage.SetText(temp);\r
+ BSTR HUGEP *pbRevNames;\r
+ BSTR HUGEP *pbRevValues;\r
+\r
+ HRESULT hr1 = SafeArrayAccessData(revPropNames, (void HUGEP**)&pbRevNames);\r
+ if (SUCCEEDED(hr1))\r
+ {\r
+ HRESULT hr2 = SafeArrayAccessData(revPropValues, (void HUGEP**)&pbRevValues);\r
+ if (SUCCEEDED(hr2))\r
+ {\r
+ if (revPropNames->rgsabound->cElements == revPropValues->rgsabound->cElements)\r
+ {\r
+ for (ULONG i = 0; i < revPropNames->rgsabound->cElements; i++)\r
+ {\r
+// m_revProps[pbRevNames[i]] = pbRevValues[i];\r
+ }\r
+ }\r
+ SafeArrayUnaccessData(revPropValues);\r
+ }\r
+ SafeArrayUnaccessData(revPropNames);\r
+ }\r
+ if (revPropNames)\r
+ SafeArrayDestroy(revPropNames);\r
+ if (revPropValues)\r
+ SafeArrayDestroy(revPropValues);\r
+ }\r
}\r
else\r
{\r
// if IBugTraqProvider2 failed, try IBugTraqProvider\r
CComPtr<IBugTraqProvider> pProvider = NULL;\r
- HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider);\r
+ hr = m_BugTraqProvider.QueryInterface(&pProvider);\r
if (FAILED(hr))\r
{\r
CString sErr;\r
else\r
m_cLogMessage.SetText(temp);\r
}\r
+ m_sLogMessage = m_cLogMessage.GetText();\r
+ if (!m_ProjectProperties.sMessage.IsEmpty())\r
+ {\r
+ CString sBugID = m_ProjectProperties.FindBugID(m_sLogMessage);\r
+ if (!sBugID.IsEmpty())\r
+ {\r
+ SetDlgItemText(IDC_BUGID, sBugID);\r
+ }\r
+ }\r
\r
m_cLogMessage.SetFocus();\r
\r
+ SysFreeString(parameters);\r
+ SysFreeString(commonRoot);\r
+ SafeArrayDestroy(pathList);\r
+ SysFreeString(originalMessage);\r
SysFreeString(temp);\r
-#endif\r
+\r
}\r
\r
LRESULT CCommitDlg::OnGitStatusListCtrlCheckChanged(WPARAM, LPARAM)\r
SetWindowText(m_sWindowTitle + _T(" - ") + commonDir.GetWinPathString());\r
\r
}\r
+\r
+void CCommitDlg::OnStnClickedBugidlabel()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+}\r