Roger Lipscombe wrote:
> I hope to have a patch available for discussion in a day or so.
>
OK. It turned out to be much, much simpler than I thought it would be.
The patch is attached. It's had minimal testing so far, but it's
something to be going on with.
Cheers,
Roger.
Index: Languages/Tortoise.pot
===================================================================
--- Languages/Tortoise.pot (revision 12001)
+++ Languages/Tortoise.pot (working copy)
@@ -1273,6 +1273,10 @@
msgid "Browse..."
msgstr ""
+#. Resource IDs: (1382)
+msgid "Bug Tracker..."
+msgstr ""
+
#. Resource IDs: (1119)
msgid "Bug-&ID / Issue-Nr:"
msgstr ""
@@ -3132,6 +3136,10 @@
msgid "Invalid revision range!\nValid revisions are numbers and HEAD, separated by commas.\nA range can be specified with a dash.\nExample: 2-5,7,10,44-70,300-HEAD"
msgstr ""
+#. Resource IDs: (570)
+msgid "Issue Tracker Hook"
+msgstr ""
+
#. Resource IDs: (145)
msgid "It is not possible to rename a file by changing the case of its name alone.\nFor example, you can't make MyFile.txt become MYFILE.txt.\nPlease consult the documentation for a way to work around this limitation."
msgstr ""
Index: src/Resources/TortoiseProcENG.rc
===================================================================
--- src/Resources/TortoiseProcENG.rc (revision 12001)
+++ src/Resources/TortoiseProcENG.rc (working copy)
@@ -840,6 +840,8 @@
, 4OC
+ src/TortoiseProc/CommitDlg.cpp
===================================================================
--- src/TortoiseProc/CommitDlg.cpp (revision 12001)
+++ src/TortoiseProc/CommitDlg.cpp (working copy)
@@ -29,6 +29,7 @@
#include "Registry.h"
#include "SVNStatus.h"
#include "HistoryDlg.h"
+#include "Hooks.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -82,6 +83,7 @@
ON_BN_CLICKED(IDHELP, OnBnClickedHelp)
ON_BN_CLICKED(IDC_SHOWUNVERSIONED, OnBnClickedShowunversioned)
ON_BN_CLICKED(IDC_HISTORY, OnBnClickedHistory)
+ ON_BN_CLICKED(IDC_BUGTEXTBUTTON, OnBnClickedBugtextbutton)
ON_EN_CHANGE(IDC_LOGMESSAGE, OnEnChangeLogmessage)
ON_REGISTERED_MESSAGE(CSVNStatusListCtrl::SVNSLNM_ITEMCOUNTCHANGED, OnSVNStatusListCtrlItemCountChanged)
ON_REGISTERED_MESSAGE(CSVNStatusListCtrl::SVNSLNM_NEEDSREFRESH, OnSVNStatusListCtrlNeedsRefresh)
@@ -130,21 +132,30 @@
m_SelectAll.SetCheck(BST_INDETERMINATE);
- if (m_ProjectProperties.sMessage.IsEmpty())
+ if (CHooks::Instance().HasIssueTracker(m_pathList))
{
GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);
+ GetDlgItem(IDC_BUGTEXTBUTTON)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
}
- else
+ else if (!m_ProjectProperties.sMessage.IsEmpty())
{
GetDlgItem(IDC_BUGID)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_SHOW);
if (!m_ProjectProperties.sLabel.IsEmpty())
SetDlgItemText(IDC_BUGIDLABEL, m_ProjectProperties.sLabel);
+ GetDlgItem(IDC_BUGTEXTBUTTON)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BUGID)->SetFocus();
}
-
+ else
+ {
+ GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);
+ GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);
+ GetDlgItem(IDC_BUGTEXTBUTTON)->ShowWindow(SW_HIDE);
+ GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
+ }
+
if (!m_sLogMessage.IsEmpty())
m_cLogMessage.SetText(m_sLogMessage);
@@ -160,6 +171,7 @@
AddAnchor(IDC_COMMITLABEL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_BUGIDLABEL, TOP_RIGHT);
AddAnchor(IDC_BUGID, TOP_RIGHT);
+ AddAnchor(IDC_BUGTEXTBUTTON, TOP_RIGHT);
AddAnchor(IDC_COMMIT_TO, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_MESSAGEGROUP, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_HISTORY, TOP_LEFT);
@@ -1094,6 +1106,17 @@
GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
}
+void CCommitDlg::OnBnClickedBugtextbutton()
+{
+ CString sMsg = m_cLogMessage.GetText();
+ DWORD exitcode = 0;
+ CString sError;
+ if (CHooks::Instance().IssueTracker(m_pathList, sMsg, exitcode, sError)&&exitcode==0)
+ {
+ m_cLogMessage.SetText(sMsg);
+ }
+}
+
LRESULT CCommitDlg::OnSVNStatusListCtrlCheckChanged(WPARAM, LPARAM)
{
UpdateOKButton();
Index: src/TortoiseProc/CommitDlg.h
===================================================================
--- src/TortoiseProc/CommitDlg.h (revision 12001)
+++ src/TortoiseProc/CommitDlg.h (working copy)
@@ -76,6 +76,7 @@
afx_msg void OnBnClickedHelp();
afx_msg void OnBnClickedShowunversioned();
afx_msg void OnBnClickedHistory();
+ afx_msg void OnBnClickedBugtextbutton();
afx_msg void OnEnChangeLogmessage();
afx_msg LRESULT OnSVNStatusListCtrlItemCountChanged(WPARAM, LPARAM);
afx_msg LRESULT OnSVNStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
Index: src/TortoiseProc/resource.h
===================================================================
--- src/TortoiseProc/resource.h (revision 12001)
+++ src/TortoiseProc/resource.h (working copy)
@@ -1277,6 +1277,7 @@
#define IDS_HOOKTYPE_STARTUPDATE 9103
#define IDS_HOOKTYPE_PREUPDATE 9104
#define IDS_HOOKTYPE_POSTUPDATE 9105
+#define IDS_HOOKTYPE_ISSUETRACKER 9106
#define IDS_PROP_TT_IGNORE 9200
#define IDS_PROP_TT_KEYWORDS 9201
#define IDS_PROP_TT_EXECUTABLE 9202
Index: src/TortoiseProc/Settings/SetHooksAdv.cpp
===================================================================
--- src/TortoiseProc/Settings/SetHooksAdv.cpp (revision 12001)
+++ src/TortoiseProc/Settings/SetHooksAdv.cpp (working copy)
@@ -71,6 +71,8 @@
m_cHookTypeCombo.SetItemData(index, pre_update_hook);
index = m_cHookTypeCombo.AddString(CString(MAKEINTRESOURCE(IDS_HOOKTYPE_POSTUPDATE)));
m_cHookTypeCombo.SetItemData(index, post_update_hook);
+ index = m_cHookTypeCombo.AddString(CString(MAKEINTRESOURCE(IDS_HOOKTYPE_ISSUETRACKER)));
+ m_cHookTypeCombo.SetItemData(index, issue_tracker_hook);
// preselect the right hook type in the combobox
for (int i=0; i<m_cHookTypeCombo.GetCount(); ++i)
{
Index: src/Utils/Hooks.cpp
===================================================================
--- src/Utils/Hooks.cpp (revision 12001)
+++ src/Utils/Hooks.cpp (working copy)
@@ -173,6 +173,8 @@
return _T("pre_update_hook");
case post_update_hook:
return _T("post_update_hook");
+ case issue_tracker_hook:
+ return _T("issue_tracker_hook");
}
return _T("");
}
@@ -191,6 +193,8 @@
return pre_update_hook;
if (s.Compare(_T("post_update_hook"))==0)
return post_update_hook;
+ if (s.Compare(_T("issue_tracker_hook"))==0)
+ return issue_tracker_hook;
return unknown_hook;
}
@@ -303,6 +307,30 @@
return true;
}
+bool CHooks::HasIssueTracker(const CTSVNPathList& pathList)
+{
+ hookiterator it = FindItem(issue_tracker_hook, pathList);
+ if (it == end())
+ return false;
+ return true;
+}
+
+bool CHooks::IssueTracker(const CTSVNPathList& pathList, CString& message, DWORD& exitcode, CString& error)
+{
+ hookiterator it = FindItem(issue_tracker_hook, pathList);
+ if (it == end())
+ return false;
+ CString sCmd = it->second.commandline;
+ SubstitutePaths(sCmd, pathList);
+ CTSVNPath temppath = SubstituteMessageFile(sCmd, message);
+ exitcode = RunScript(sCmd, error, it->second.bWait, it->second.bShow);
+ if (!exitcode && !temppath.IsEmpty())
+ {
+ CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message);
+ }
+ return true;
+}
+
hookiterator CHooks::FindItem(hooktype t, const CTSVNPathList& pathList)
{
hookkey key;
Index: src/Utils/Hooks.h
===================================================================
--- src/Utils/Hooks.h (revision 12001)
+++ src/Utils/Hooks.h (working copy)
@@ -34,7 +34,8 @@
post_commit_hook,
start_update_hook,
pre_update_hook,
- post_update_hook
+ post_update_hook,
+ issue_tracker_hook
} hooktype;
/**
@@ -216,6 +217,11 @@
bool PostCommit(const CTSVNPathList& pathList, svn_depth_t depth,
SVNRev rev, const CString& message,
DWORD& exitcode, CString& error);
+
+ bool HasIssueTracker(const CTSVNPathList& pathList);
+ bool IssueTracker(const CTSVNPathList& pathList, CString& message,
+ DWORD& exitcode, CString& error);
+
private:
/**
* Starts a new process, specified in \c cmd.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-02-01 16:46:06 CET