FogBugz Plugin Interfaces > Source Control Integration > IPluginCVSJoin and IPluginCVSCommit
This article will demonstrate simple code for a FogBugz plugin that implements the IPluginCVSJoin and IPluginCVSCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.
(Note: This plugin will only function if your FogBugz site admin has set up source control integration.)
The plugin code presented allows you assign a "Level of Awesomeness" to a source control check-in record, and provides a template for performing custom operations when a check-in is comitted to the FogBugz database.
To demonstrate how source control check-in commit and rollback occurs, all of the member functions of IPluginCVSCommit generate a UI notification (using CPluginApi.Notifications) indicating that they were called.
In the event that multiple installed plugins implement the IPluginCVSCommit interface:
- For the CVSCommitBefore and CVSCommitAfter methods, FogBugz handles each plugin instance implementing IPluginCVSCommit in the order that the plugin was installed. (The CPluginApi.PluginPrefix property reveals this; for example it will return "P4" if called from the 4th plugin ever installed on the FogBugz site.)
- For the CVSCommitRollback method, FogBugz first handles the plugin instance that returned false from CVSCommitBefore, then calls the CVSCommitRollback function of all plugin instances that previously called CVSCommitBefore in reverse order (ie, they're "popped off the stack").
The example plugin uses the IPluginCVSJoin method to specify a table containing an integer "ixCVS" column, allowing FogBugz to automatically join the columns of that table to the "CVS" table. This allows the plugin developer to use CCVS.GetPluginField() and CCVS.GetPluginFieldOriginal() to easily retrieve column values from the joined table, and use CCVS.SetPluginField() to specify a value to be set upon commit.
Compile and Install It On Your Own
Download the source file: IPluginCVSJoin_Commit_Example.cs
Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin