Ho开发者_运维问答w can I write a post_commit (like) plugin that is executed only when a specific branch is commited?.
Right now I have written a plugin in "~/.bazaar/plugins/" directory, but the problem is that the plugin is executing when any branch in the repository is commited.
The idea is to trigger a call to a Continuous Integration server (Hudson) to automatically build the project-job when a revision is commited
Thanks.
There is no automatic way to associate a plugin to specific branch, but you can use configuration files (either branch.conf or locations.conf) to control the behavior of your plugin. So your plugin only should open the branch config and read some option from there, for example:
my_plugin_post_commit = enabled
And if required option is present in branch config then you execute required operations, otherwise your plugin simply exits and that's all.
精彩评论