Stefan Küng wrote:
> Roger Lipscombe wrote:
>> I'm currently hacking[1] on more complete issue-tracker integration
>> into TSVN (search the mailing list for details). This uses COM, with
>> TortoiseProc as the interface consumer, and specific implementations
>> of the interface for different issue-tracking systems. This meets a
>> specific need we have where I work, where we'd like to integrate TSVN
>> with TargetProcess. We'll be creating[2] an implementation of this
>> interface that talks to TargetProcess's web service API.
>>
>> Assuming that Stefan accepts this work into the TSVN core (and I hope
>> he does; it's quite cool, and I don't fancy maintaining a set of
>> patches for it), this raises a licensing issue:
>
> If you want this to get into the 1.5 release (which is only a few
> weeks away now!), you have to hurry. I'd say you have at most a week
> before we branch the 1.5.x stabilization branch. After that, nothing
> new gets merged back there.
>
I'm on it. I've got the code basically finished in a demonstration
project, along with two really simply example implementations (one in
ATL, one in C#). I'm just in the process of integrating this into
TortoiseProc. I've got the settings dialogs completed, and I'm just
about to start integrating my stuff into the commit dialog. I'll send
patches and documentation early this week.
The model is that a working copy is associated with a
(provider_class_id, provider_parameters) tuple. The provider_class_id is
a CLSID. The provider_parameters value is a simple string (e.g.
something like a URL or a SQL Server connection string).
I've added another page and dialog to the settings dialog. It's modeled
on (and started as a copy-paste of) the existing CSetHooks and
CSetHooksAdv dialogs. There'll be a hyperlink control on the commit
dialog (to replace the issue_tracker_hook stuff that I cobbled together
a while back). This link will get the plugin to kick off an in-proc
modal dialog, avoiding all of the repaint problems with the hook-based
solution.
In broad strokes, to write an integration plugin, you implement the
IBugTraqProvider COM interface, and register your object as implementing
the "TortoiseSVN BugTraq Providers" component category. This
registration makes it easy for the settings dialog to find a list of
available plugins.
The IBugTraqProvider interface is extremely simple. It has three methods:
- GetLinkText(HWND hParentWnd, BSTR parameters, [retval] BSTR *linkText)
This is called when the commit dialog needs some text to put on the
hyperlink control. It should assume the current thread locale for l10n
purposes. It gets passed the parameters in case the URL (e.g.) makes a
difference to the text to be displayed. It has hParentWnd in case it
needs to display an error message (although this is not recommended,
because it will break the user's flow). The text to be displayed is
returned in linkText.
- GetCommitMessage(HWND hParentWnd, BSTR parameters, BSTR
originalMessage, [retval] BSTR *newMessage);
This is called when you click on the hyperlink in the commit dialog. It
gets passed the HWND of the commit dialog, the arbitrary parameter
string, the current message that's in the commit dialog. It returns a
new string to put in the commit dialog. The plugin is responsible for
the decision about prepending, appending or replacing the text entirely.
- ValidateParameters(HWND hParentWnd, BSTR parameters, [retval]
VARIANT_BOOL *valid);
This is called from the settings dialog. This allows the provider to
check that the parameters are OK. It can do basic syntax checking, it
can check that the server is reachable, or it can do nothing. Again, it
gets an HWND. The provider must display its own error message boxes,
using this as the parent.
And that's it.
I considered allowing the provider to bring up its own configuration
dialog (for editing the parameter string), but there's not really enough
time, and it can always be added in future (this being COM).
I'll have something early this week. Hopefully tomorrow afternoon. Does
anyone have time to knock together a couple of other example providers?
I've got C++ (ATL) and C# covered; I'd like to see how interoperable
this is with providers written in (for example) Python or Ruby.
Cheers,
Roger.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-04-27 20:37:05 CEST