TortoiseSVN 1.5 and later can use plugins which implement the IBugtraqProvider interface. The interface provides a few methods which plugins can use to interact with the issue tracker.
HRESULT ValidateParameters ( // Parent window for any UI that needs to be // displayed during validation. [in] HWND hParentWnd, // The parameter string that needs to be validated. [in] BSTR parameters, // Is the string valid? [out, retval] VARIANT_BOOL *valid );
This method is called from the settings dialog where the user can
add and configure the plugin. The
can be used by a plugin to get additional required information, e.g., the URL
to the issue tracker, login information, etc.
The plugin should verify the
parameters string and
show an error dialog if the string is not valid. The
parameter should be used for any dialog the plugin shows as the parent window.
The plugin must return TRUE if the validation of the
string is successful. If the plugin returns FALSE, the settings dialog won't
allow the user to add the plugin to a working copy path.
HRESULT GetLinkText ( // Parent window for any (error) UI that needs to be displayed. [in] HWND hParentWnd, // The parameter string, just in case you need to talk to your // web service (e.g.) to find out what the correct text is. [in] BSTR parameters, // What text do you want to display? // Use the current thread locale. [out, retval] BSTR *linkText );
The plugin can provide a string here which is used in the TortoiseSVN
commit dialog for the button which invokes the plugin, e.g., "Choose issue"
or "Select ticket". Make sure the string is not too long, otherwise it
might not fit into the button.
If the method returns an error (e.g.,
E_NOTIMPL), a default
text is used for the button.
HRESULT GetCommitMessage ( // Parent window for your provider's UI. [in] HWND hParentWnd, // Parameters for your provider. [in] BSTR parameters, [in] BSTR commonRoot, [in] SAFEARRAY(BSTR) pathList, // The text already present in the commit message. // Your provider should include this text in the new message, // where appropriate. [in] BSTR originalMessage, // The new text for the commit message. // This replaces the original message. [out, retval] BSTR *newMessage );
This is the main method of the plugin. This method is called from the TortoiseSVN commit dialog when the user clicks on the plugin button.
parameters string is the string the
user has to enter in the settings dialog when he configures
the plugin. Usually a plugin would use this to find the URL
of the issue tracker and/or login information or more.
commonRoot string contains the parent path
of all items selected to bring up the commit dialog. Note that this
is not the root path of all items which the user has selected in
the commit dialog.
For the branch/tag dialog, this is the path which is to be copied.
pathList parameter contains an array of paths
(as strings) which the user has selected for the commit.
originalMessage parameter contains the text
entered in the log message box in the commit dialog. If the user
has not yet entered any text, this string will be empty.
newMessage return string is copied into
the log message edit box in the commit dialog, replacing whatever
is already there. If a plugin does not modify the
string, it must return the same string again here, otherwise
any text the user has entered will be lost.