TortoiseSVN 1.5 en later kunnen werken met plugins die gebruik maken van de IBugtraqProvider interface. Deze interface biedt enkele methodes die plugins kunnen gebruiken om de communiceren met een issue tracker.
HRESULT ValidateParameters ( // Hoofd scherm elke UI die weergegeven // moet worden tijdens validatie. [in] HWND hParentWnd, // De parameter tekst die gevalideerd moet worden. [in] BSTR parameters, // Is de tekst geldig? [out, retval] VARIANT_BOOL *valid );
This method is called from the settings dialog where the user can add and configure the plugin. The parameters
string 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 hParentWnd
parameter should be used for any dialog the plugin shows as the parent window. The plugin must return TRUE if the validation of the parameters
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 ( // Hoofdscherm voor elke (foutmeldings) UI die getoond moet worden. [in] HWND hParentWnd, // De parameter tekst, voor het geval je informatie moet geven aan je // web service (bijv.) om uit te vinden wat de juist tekst is. [in] BSTR parameters, // Welke tekst wilt je tonen? // Gebruik de huidige 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 ( // Hoofdscherm voor je provider's UI. [in] HWND hParentWnd, // Parameters voor je provider. [in] BSTR parameters, [in] BSTR commonRoot, [in] SAFEARRAY(BSTR) pathList, // De tekst die al in het vastleg venster staat. // Je provider moet deze tekst opnemen in het // nieuwe bericht, indien gewenst. [in] BSTR originalMessage, // De nieuwe vastleg tekst. // Deze vervangt het originele bericht. [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.
The 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.
The 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.
The pathList
parameter contains an array of paths (as strings) which the user has selected for the commit.
The 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.
The 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 originalMessage
string, it must return the same string again here, otherwise any text the user has entered will be lost.