• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision12839 (tree)
Zeit2008-05-02 03:05:15
Autorstefankueng

Log Message

Patch from Roger Lipscombe:
* Added the path list and common root to the COM interface; tweaked the C# definition to match.
* Implemented ATL sample that pretty much does what the original CHooks::IssueTracker code did.

Ändern Zusammenfassung

Diff

--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/ExampleAtlPlugin.cpp (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/ExampleAtlPlugin.cpp (revision 12839)
@@ -0,0 +1,70 @@
1+// ExampleAtlPlugin.cpp : Implementation of DLL Exports.
2+
3+
4+#include "stdafx.h"
5+#include "resource.h"
6+#include "ExampleAtlPlugin_i.h"
7+#include "dllmain.h"
8+
9+// Used to determine whether the DLL can be unloaded by OLE
10+STDAPI DllCanUnloadNow(void)
11+{
12+ return _AtlModule.DllCanUnloadNow();
13+}
14+
15+
16+// Returns a class factory to create an object of the requested type
17+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
18+{
19+ return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
20+}
21+
22+
23+// DllRegisterServer - Adds entries to the system registry
24+STDAPI DllRegisterServer(void)
25+{
26+ // registers object, typelib and all interfaces in typelib
27+ HRESULT hr = _AtlModule.DllRegisterServer();
28+ return hr;
29+}
30+
31+
32+// DllUnregisterServer - Removes entries from the system registry
33+STDAPI DllUnregisterServer(void)
34+{
35+ HRESULT hr = _AtlModule.DllUnregisterServer();
36+ return hr;
37+}
38+
39+// DllInstall - Adds/Removes entries to the system registry per user
40+// per machine.
41+STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
42+{
43+ HRESULT hr = E_FAIL;
44+ static const wchar_t szUserSwitch[] = _T("user");
45+
46+ if (pszCmdLine != NULL)
47+ {
48+ if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
49+ {
50+ AtlSetPerUserRegistration(true);
51+ }
52+ }
53+
54+ if (bInstall)
55+ {
56+ hr = DllRegisterServer();
57+ if (FAILED(hr))
58+ {
59+ DllUnregisterServer();
60+ }
61+ }
62+ else
63+ {
64+ hr = DllUnregisterServer();
65+ }
66+
67+ return hr;
68+}
69+
70+
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/Provider.cpp (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/Provider.cpp (revision 12839)
@@ -0,0 +1,146 @@
1+#include "stdafx.h"
2+#include "Provider.h"
3+#include "WaitDialog.h"
4+
5+CProvider::CProvider()
6+{
7+}
8+
9+HRESULT CProvider::FinalConstruct()
10+{
11+ return S_OK;
12+}
13+
14+void CProvider::FinalRelease()
15+{
16+}
17+
18+CProvider::parameters_t CProvider::ParseParameters(BSTR parameters) const
19+{
20+ CString temp(parameters);
21+
22+ parameters_t result;
23+
24+ // TODO: Handle quoting and stuff
25+ int pos = 0;
26+ CString token = temp.Tokenize(_T(";"), pos);
27+ while (token != _T(""))
28+ {
29+ int x = token.Find('=');
30+ CString name = token.Left(x);
31+ CString value = token.Mid(x + 1);
32+
33+ result[name] = value;
34+
35+ token = temp.Tokenize(_T(";"), pos);
36+ }
37+
38+ return result;
39+}
40+
41+HRESULT STDMETHODCALLTYPE CProvider::ValidateParameters(
42+ /* [in] */ HWND hParentWnd,
43+ /* [in] */ BSTR parameters,
44+ /* [retval][out] */ VARIANT_BOOL *valid)
45+{
46+ // Don't bother validating the parameters yet.
47+ *valid = VARIANT_TRUE;
48+ return S_OK;
49+}
50+
51+HRESULT STDMETHODCALLTYPE CProvider::GetLinkText(
52+ /* [in] */ HWND hParentWnd,
53+ /* [in] */ BSTR parameters,
54+ /* [retval][out] */ BSTR *linkText)
55+{
56+ parameters_t params = ParseParameters(parameters);
57+ CString prompt = params[CString("Prompt")];
58+ if (prompt.IsEmpty())
59+ *linkText = SysAllocString(L"Choose Task...");
60+ else
61+ *linkText = prompt.AllocSysString();
62+
63+ return S_OK;
64+}
65+
66+HRESULT STDMETHODCALLTYPE CProvider::GetCommitMessage(
67+ /* [in] */ HWND hParentWnd,
68+ /* [in] */ BSTR parameters,
69+ /* [in] */ BSTR commonRoot,
70+ /* [in] */ SAFEARRAY * pathList,
71+ /* [in] */ BSTR originalMessage,
72+ /* [retval][out] */ BSTR *newMessage)
73+{
74+ // TODO: Error checking.
75+
76+ USES_CONVERSION;
77+
78+ parameters_t params = ParseParameters(parameters);
79+ CString commandLine = params[CString("CommandLine")];
80+
81+ if (commandLine.IsEmpty())
82+ {
83+ MessageBox(hParentWnd, _T("CommandLine parameter is empty"), _T("ExampleAtlPlugin"), MB_OK | MB_ICONERROR);
84+ return S_OK;
85+ }
86+
87+ TCHAR szTempPath[MAX_PATH];
88+ GetTempPath(ARRAYSIZE(szTempPath), szTempPath);
89+
90+ // Create a temporary file to hold the path list, and write the list to the file.
91+ TCHAR szPathListTempFile[MAX_PATH];
92+ GetTempFileName(szTempPath, _T("svn"), 0, szPathListTempFile);
93+
94+ DWORD bytesWritten;
95+ HANDLE hPathListFile = CreateFile(szPathListTempFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
96+
97+ LONG a, b;
98+ if (FAILED(SafeArrayGetLBound(pathList, 1, &a)) || (FAILED(SafeArrayGetUBound(pathList, 1, &b))))
99+ return E_FAIL;
100+
101+ for (LONG i = a; i <= b; ++i)
102+ {
103+ BSTR path = NULL;
104+ SafeArrayGetElement(pathList, &i, &path);
105+
106+ CStringA line = OLE2A(path);
107+ line += "\r\n";
108+
109+ WriteFile(hPathListFile, line, line.GetLength(), &bytesWritten, NULL);
110+ }
111+
112+ CloseHandle(hPathListFile);
113+
114+ TCHAR szOriginalMessageTempFile[MAX_PATH];
115+ GetTempFileName(szTempPath, _T("svn"), 0, szOriginalMessageTempFile);
116+
117+ HANDLE hOriginalMessageFile = CreateFile(szOriginalMessageTempFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
118+
119+ CStringA temp = OLE2A(originalMessage);
120+ WriteFile(hOriginalMessageFile, temp, temp.GetLength(), &bytesWritten, NULL);
121+
122+ CloseHandle(hOriginalMessageFile);
123+
124+ commandLine.AppendFormat(_T(" \"%s\" \"%ls\" \"%s\""), szPathListTempFile, commonRoot, szOriginalMessageTempFile);
125+
126+ CString message = originalMessage;
127+ CWaitDialog dlg(commandLine);
128+ if (dlg.DoModal() == IDOK)
129+ {
130+ HANDLE hOrig = CreateFile(szOriginalMessageTempFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
131+ DWORD cb = GetFileSize(hOrig, NULL);
132+ BYTE *buffer = (BYTE *)malloc(cb + 1);
133+ memset(buffer, 0, cb + 1);
134+ DWORD bytesRead;
135+ ReadFile(hOrig, buffer, cb, &bytesRead, NULL);
136+ CloseHandle(hOrig);
137+
138+ message = A2T((const char *)buffer);
139+ }
140+
141+ DeleteFile(szPathListTempFile);
142+ DeleteFile(szOriginalMessageTempFile);
143+
144+ *newMessage = message.AllocSysString();
145+ return S_OK;
146+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/Provider.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/Provider.h (revision 12839)
@@ -0,0 +1,52 @@
1+#pragma once
2+#include "resource.h" // main symbols
3+#include "ExampleAtlPlugin_i.h"
4+#include "..\inc\IBugTraqProvider_h.h"
5+
6+class ATL_NO_VTABLE CProvider :
7+ public CComObjectRootEx<CComSingleThreadModel>,
8+ public CComCoClass<CProvider, &CLSID_Provider>,
9+ public IBugTraqProvider
10+{
11+public:
12+ CProvider();
13+
14+DECLARE_REGISTRY_RESOURCEID(IDR_PROVIDER)
15+
16+DECLARE_NOT_AGGREGATABLE(CProvider)
17+
18+BEGIN_COM_MAP(CProvider)
19+ COM_INTERFACE_ENTRY(IBugTraqProvider)
20+END_COM_MAP()
21+
22+ DECLARE_PROTECT_FINAL_CONSTRUCT()
23+
24+ HRESULT FinalConstruct();
25+ void FinalRelease();
26+
27+// IBugTraqProvider
28+public:
29+ virtual HRESULT STDMETHODCALLTYPE ValidateParameters(
30+ /* [in] */ HWND hParentWnd,
31+ /* [in] */ BSTR parameters,
32+ /* [retval][out] */ VARIANT_BOOL *valid);
33+
34+ virtual HRESULT STDMETHODCALLTYPE GetLinkText(
35+ /* [in] */ HWND hParentWnd,
36+ /* [in] */ BSTR parameters,
37+ /* [retval][out] */ BSTR *linkText);
38+
39+ virtual HRESULT STDMETHODCALLTYPE GetCommitMessage(
40+ /* [in] */ HWND hParentWnd,
41+ /* [in] */ BSTR parameters,
42+ /* [in] */ BSTR commonRoot,
43+ /* [in] */ SAFEARRAY * pathList,
44+ /* [in] */ BSTR originalMessage,
45+ /* [retval][out] */ BSTR *newMessage);
46+
47+private:
48+ typedef std::map< CString, CString > parameters_t;
49+ parameters_t ParseParameters(BSTR parameters) const;
50+};
51+
52+OBJECT_ENTRY_AUTO(__uuidof(Provider), CProvider)
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/WaitDialog.cpp (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/WaitDialog.cpp (revision 12839)
@@ -0,0 +1,66 @@
1+#include "stdafx.h"
2+#include "WaitDialog.h"
3+
4+CWaitDialog::CWaitDialog(const CString &commandLine)
5+ : m_hThread(NULL)
6+ , m_commandLine(commandLine)
7+{
8+}
9+
10+CWaitDialog::~CWaitDialog()
11+{
12+}
13+
14+LRESULT CWaitDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
15+{
16+ // Disable the close button (the 'X').
17+ HMENU hSystemMenu = GetSystemMenu(FALSE);
18+ EnableMenuItem(hSystemMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
19+
20+ // Kick off the thread that actually runs the process.
21+ m_hThread = (HANDLE)_beginthreadex(NULL, 0, _ThreadRoutine, this, 0, NULL);
22+
23+ bHandled = TRUE;
24+ return TRUE;
25+}
26+
27+LRESULT CWaitDialog::OnProcessStarting(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
28+{
29+ return 0;
30+}
31+
32+LRESULT CWaitDialog::OnProcessCompleted(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
33+{
34+ CloseHandle(m_hThread);
35+ EndDialog(IDOK);
36+ return 0;
37+}
38+
39+unsigned int CWaitDialog::ThreadRoutine()
40+{
41+ PostMessage(WM_PROCESS_STARTING);
42+
43+ STARTUPINFO si;
44+ memset(&si, 0, sizeof(STARTUPINFO));
45+ si.cb = sizeof(STARTUPINFO);
46+
47+ PROCESS_INFORMATION pi;
48+ memset(&pi, 0, sizeof(PROCESS_INFORMATION));
49+
50+ BOOL ok;
51+
52+#if defined(UNICODE)
53+ WCHAR *temp = _wcsdup(m_commandLine);
54+ ok = CreateProcess(NULL, temp, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
55+ free(temp);
56+#else
57+ ok = CreateProcess(NULL, m_commandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
58+#endif
59+
60+ if (ok)
61+ WaitForSingleObject(pi.hProcess, INFINITE);
62+
63+ PostMessage(WM_PROCESS_COMPLETED);
64+
65+ return 0;
66+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/WaitDialog.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/WaitDialog.h (revision 12839)
@@ -0,0 +1,45 @@
1+#pragma once
2+
3+#include "resource.h"
4+
5+const UINT WM_PROCESS_STARTING = WM_APP + 42;
6+const UINT WM_PROCESS_COMPLETED = WM_APP + 43;
7+
8+class CWaitDialog :
9+ public CDialogImpl<CWaitDialog>
10+{
11+ HANDLE m_hThread;
12+ CString m_commandLine;
13+
14+public:
15+ CWaitDialog(const CString &commandLine);
16+ ~CWaitDialog();
17+
18+ enum { IDD = IDD_WAITDIALOG };
19+
20+BEGIN_MSG_MAP(CWaitDialog)
21+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
22+ MESSAGE_HANDLER(WM_PROCESS_STARTING, OnProcessStarting)
23+ MESSAGE_HANDLER(WM_PROCESS_COMPLETED, OnProcessCompleted)
24+END_MSG_MAP()
25+
26+// Handler prototypes:
27+// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
28+// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
29+// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
30+
31+ LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
32+ LRESULT OnProcessStarting(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
33+ LRESULT OnProcessCompleted(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
34+
35+private:
36+ static unsigned int __stdcall _ThreadRoutine(void *pParam)
37+ {
38+ CWaitDialog *pThis = reinterpret_cast<CWaitDialog *>(pParam);
39+ return pThis->ThreadRoutine();
40+ }
41+
42+ unsigned int ThreadRoutine();
43+};
44+
45+
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/dllmain.cpp (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/dllmain.cpp (revision 12839)
@@ -0,0 +1,15 @@
1+// dllmain.cpp : Implementation of DllMain.
2+
3+#include "stdafx.h"
4+#include "resource.h"
5+#include "ExampleAtlPlugin_i.h"
6+#include "dllmain.h"
7+
8+CExampleAtlPluginModule _AtlModule;
9+
10+// DLL Entry Point
11+extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
12+{
13+ hInstance;
14+ return _AtlModule.DllMain(dwReason, lpReserved);
15+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/dllmain.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/dllmain.h (revision 12839)
@@ -0,0 +1,10 @@
1+// dllmain.h : Declaration of module class.
2+
3+class CExampleAtlPluginModule : public CAtlDllModuleT< CExampleAtlPluginModule >
4+{
5+public :
6+ DECLARE_LIBID(LIBID_ExampleAtlPluginLib)
7+ DECLARE_REGISTRY_APPID_RESOURCEID(IDR_EXAMPLEATLPLUGIN, "{68BD4B94-C38D-4C03-8101-75176E711DC1}")
8+};
9+
10+extern class CExampleAtlPluginModule _AtlModule;
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/resource.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/resource.h (revision 12839)
@@ -0,0 +1,19 @@
1+//{{NO_DEPENDENCIES}}
2+// Microsoft Visual C++ generated include file.
3+// Used by ExampleAtlPlugin.rc
4+//
5+#define IDS_PROJNAME 100
6+#define IDR_EXAMPLEATLPLUGIN 101
7+#define IDR_PROVIDER 102
8+#define IDD_WAITDIALOG 103
9+
10+// Next default values for new objects
11+//
12+#ifdef APSTUDIO_INVOKED
13+#ifndef APSTUDIO_READONLY_SYMBOLS
14+#define _APS_NEXT_RESOURCE_VALUE 201
15+#define _APS_NEXT_COMMAND_VALUE 32768
16+#define _APS_NEXT_CONTROL_VALUE 201
17+#define _APS_NEXT_SYMED_VALUE 104
18+#endif
19+#endif
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/stdafx.cpp (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/stdafx.cpp (revision 12839)
@@ -0,0 +1,5 @@
1+// stdafx.cpp : source file that includes just the standard includes
2+// ExampleAtlPlugin.pch will be the pre-compiled header
3+// stdafx.obj will contain the pre-compiled type information
4+
5+#include "stdafx.h"
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/stdafx.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/stdafx.h (revision 12839)
@@ -0,0 +1,26 @@
1+// stdafx.h : include file for standard system include files,
2+// or project specific include files that are used frequently,
3+// but are changed infrequently
4+
5+#pragma once
6+
7+#ifndef STRICT
8+#define STRICT
9+#endif
10+
11+#include "targetver.h"
12+
13+#define _ATL_APARTMENT_THREADED
14+#define _ATL_NO_AUTOMATIC_NAMESPACE
15+
16+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
17+
18+#include "resource.h"
19+#include <atlbase.h>
20+#include <atlcom.h>
21+#include <atlctl.h>
22+#include <atlstr.h>
23+
24+#include <map>
25+
26+using namespace ATL;
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/targetver.h (nonexistent)
+++ trunk/contrib/issue-tracker-plugins/ExampleAtlPlugin/targetver.h (revision 12839)
@@ -0,0 +1,26 @@
1+
2+#pragma once
3+
4+// The following macros define the minimum required platform. The minimum required platform
5+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
6+// your application. The macros work by enabling all features available on platform versions up to and
7+// including the version specified.
8+
9+// Modify the following defines if you have to target a platform prior to the ones specified below.
10+// Refer to MSDN for the latest info on corresponding values for different platforms.
11+#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
12+#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
13+#endif
14+
15+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
16+#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
17+#endif
18+
19+#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
20+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
21+#endif
22+
23+#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
24+#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
25+#endif
26+
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/issue-tracker-plugins/ExampleCsPlugin/MyPlugin.cs (revision 12838)
+++ trunk/contrib/issue-tracker-plugins/ExampleCsPlugin/MyPlugin.cs (revision 12839)
@@ -21,27 +21,42 @@
2121 return "Choose Issue";
2222 }
2323
24- public string GetCommitMessage(IntPtr hParentWnd, string parameters, string originalMessage)
24+ public string GetCommitMessage(IntPtr hParentWnd, string parameters, string commonRoot, string[] pathList,
25+ string originalMessage)
2526 {
26- List<TicketItem> tickets = new List<TicketItem>();
27- tickets.Add(new TicketItem(12, "Service doesn't start on Windows Vista"));
28- tickets.Add(new TicketItem(19, "About box doesn't render correctly in large fonts mode"));
27+ try
28+ {
29+ List<TicketItem> tickets = new List<TicketItem>();
30+ tickets.Add(new TicketItem(12, "Service doesn't start on Windows Vista"));
31+ tickets.Add(new TicketItem(19, "About box doesn't render correctly in large fonts mode"));
2932
30- MyIssuesForm form = new MyIssuesForm(tickets);
31- if (form.ShowDialog() != DialogResult.OK)
32- return originalMessage;
33+/*
34+ tickets.Add(new TicketItem(88, commonRoot));
35+ foreach (string path in pathList)
36+ tickets.Add(new TicketItem(99, path));
37+ */
3338
34- StringBuilder result = new StringBuilder(originalMessage);
35- if (originalMessage.Length != 0 && !originalMessage.EndsWith("\n"))
36- result.AppendLine();
39+ MyIssuesForm form = new MyIssuesForm(tickets);
40+ if (form.ShowDialog() != DialogResult.OK)
41+ return originalMessage;
3742
38- foreach (TicketItem ticket in form.TicketsFixed)
43+ StringBuilder result = new StringBuilder(originalMessage);
44+ if (originalMessage.Length != 0 && !originalMessage.EndsWith("\n"))
45+ result.AppendLine();
46+
47+ foreach (TicketItem ticket in form.TicketsFixed)
48+ {
49+ result.AppendFormat("Fixed #{0}: {1}", ticket.Number, ticket.Summary);
50+ result.AppendLine();
51+ }
52+
53+ return result.ToString();
54+ }
55+ catch (Exception ex)
3956 {
40- result.AppendFormat("Fixed #{0}: {1}", ticket.Number, ticket.Summary);
41- result.AppendLine();
57+ MessageBox.Show(ex.ToString());
58+ throw;
4259 }
43-
44- return result.ToString();
4560 }
4661 }
4762 }
--- trunk/contrib/issue-tracker-plugins/Interop.BugTraqProvider/IBugTraqProvider.cs (revision 12838)
+++ trunk/contrib/issue-tracker-plugins/Interop.BugTraqProvider/IBugTraqProvider.cs (revision 12839)
@@ -7,13 +7,18 @@
77 public interface IBugTraqProvider
88 {
99 [return: MarshalAs(UnmanagedType.VariantBool)]
10- bool ValidateParameters(IntPtr hParentWnd, [MarshalAs(UnmanagedType.BStr)] string parameters);
10+ bool ValidateParameters(IntPtr hParentWnd,
11+ [MarshalAs(UnmanagedType.BStr)] string parameters);
1112
1213 [return: MarshalAs(UnmanagedType.BStr)]
13- string GetLinkText(IntPtr hParentWnd, [MarshalAs(UnmanagedType.BStr)] string parameters);
14+ string GetLinkText(IntPtr hParentWnd,
15+ [MarshalAs(UnmanagedType.BStr)] string parameters);
1416
1517 [return: MarshalAs(UnmanagedType.BStr)]
16- string GetCommitMessage(IntPtr hParentWnd, [MarshalAs(UnmanagedType.BStr)] string parameters,
17- [MarshalAs(UnmanagedType.BStr)] string originalMessage);
18+ string GetCommitMessage(IntPtr hParentWnd,
19+ [MarshalAs(UnmanagedType.BStr)] string parameters,
20+ [MarshalAs(UnmanagedType.BStr)] string commonRoot,
21+ [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)] string[] pathList,
22+ [MarshalAs(UnmanagedType.BStr)] string originalMessage);
1823 }
1924 }
--- trunk/contrib/issue-tracker-plugins/inc/IBugTraqProvider_h.h (revision 12838)
+++ trunk/contrib/issue-tracker-plugins/inc/IBugTraqProvider_h.h (revision 12839)
@@ -4,7 +4,7 @@
44
55
66 /* File created by MIDL compiler version 7.00.0500 */
7-/* at Wed Apr 30 10:32:49 2008
7+/* at Thu May 01 15:40:50 2008
88 */
99 /* Compiler settings for .\IBugTraqProvider.idl:
1010 Oicf, W4, Zp8, env=Win32 (32b run)
@@ -98,6 +98,8 @@
9898 virtual HRESULT STDMETHODCALLTYPE GetCommitMessage(
9999 /* [in] */ HWND hParentWnd,
100100 /* [in] */ BSTR parameters,
101+ /* [in] */ BSTR commonRoot,
102+ /* [in] */ SAFEARRAY * pathList,
101103 /* [in] */ BSTR originalMessage,
102104 /* [retval][out] */ BSTR *newMessage) = 0;
103105
@@ -137,6 +139,8 @@
137139 IBugTraqProvider * This,
138140 /* [in] */ HWND hParentWnd,
139141 /* [in] */ BSTR parameters,
142+ /* [in] */ BSTR commonRoot,
143+ /* [in] */ SAFEARRAY * pathList,
140144 /* [in] */ BSTR originalMessage,
141145 /* [retval][out] */ BSTR *newMessage);
142146
@@ -169,8 +173,8 @@
169173 #define IBugTraqProvider_GetLinkText(This,hParentWnd,parameters,linkText) \
170174 ( (This)->lpVtbl -> GetLinkText(This,hParentWnd,parameters,linkText) )
171175
172-#define IBugTraqProvider_GetCommitMessage(This,hParentWnd,parameters,originalMessage,newMessage) \
173- ( (This)->lpVtbl -> GetCommitMessage(This,hParentWnd,parameters,originalMessage,newMessage) )
176+#define IBugTraqProvider_GetCommitMessage(This,hParentWnd,parameters,commonRoot,pathList,originalMessage,newMessage) \
177+ ( (This)->lpVtbl -> GetCommitMessage(This,hParentWnd,parameters,commonRoot,pathList,originalMessage,newMessage) )
174178
175179 #endif /* COBJMACROS */
176180
@@ -195,6 +199,11 @@
195199 unsigned char * __RPC_USER HWND_UserUnmarshal(unsigned long *, unsigned char *, HWND * );
196200 void __RPC_USER HWND_UserFree( unsigned long *, HWND * );
197201
202+unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
203+unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
204+unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
205+void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
206+
198207 /* end of Additional Prototypes */
199208
200209 #ifdef __cplusplus
--- trunk/contrib/issue-tracker-plugins/inc/IBugTraqProvider_i.c (revision 12838)
+++ trunk/contrib/issue-tracker-plugins/inc/IBugTraqProvider_i.c (revision 12839)
@@ -6,7 +6,7 @@
66
77
88 /* File created by MIDL compiler version 7.00.0500 */
9-/* at Wed Apr 30 10:32:49 2008
9+/* at Thu May 01 15:40:50 2008
1010 */
1111 /* Compiler settings for .\IBugTraqProvider.idl:
1212 Oicf, W4, Zp8, env=Win32 (32b run)
--- trunk/src/TortoiseProc/CommitDlg.cpp (revision 12838)
+++ trunk/src/TortoiseProc/CommitDlg.cpp (revision 12839)
@@ -1168,9 +1168,15 @@
11681168 }
11691169
11701170 BSTR parameters = m_bugtraq_association.GetParameters().AllocSysString();
1171+ BSTR commonRoot = SysAllocString(m_pathList.GetCommonRoot().GetDirectory().GetWinPath());
1172+ SAFEARRAY *pathList = SafeArrayCreateVector(VT_BSTR, 0, m_pathList.GetCount());
1173+
1174+ for (LONG index = 0; index < m_pathList.GetCount(); ++index)
1175+ SafeArrayPutElement(pathList, &index, m_pathList[index].GetSVNPathString().AllocSysString());
1176+
11711177 BSTR originalMessage = sMsg.AllocSysString();
11721178 BSTR temp = NULL;
1173- if (FAILED(hr = pProvider->GetCommitMessage(GetSafeHwnd(), parameters, originalMessage, &temp)))
1179+ if (FAILED(hr = pProvider->GetCommitMessage(GetSafeHwnd(), parameters, commonRoot, pathList, originalMessage, &temp)))
11741180 {
11751181 CString sErr;
11761182 sErr.Format(IDS_ERR_FAILEDISSUETRACKERCOM, m_bugtraq_association.GetProviderName(), _com_error(hr).ErrorMessage());
Show on old repository browser