Bitbucket synchronisation plugin
This plugin synchronises a Bitbucket repository with a local repository used by Trac.
When a Bitbucket repository is changed, this plugin pulls those changes into the local repository.
After installation of this plugin, you have to configure Bitbucket to notify Trac about changes. You do this on Bitbucket under Admin -> Services section, where you select POST service type and enter an URL of your Trac installation's /bitbucketsync handler. For example, if your Trac installation is on http://www.example.com/, then enter http://www.example.com/bitbucketsync as service URL.
Name of the repository on Bitbucket should match (it is case sensitive) the local one (you can use aliases in Trac 0.12 to assure that). User under which Trac is running on the server should have write access to the local repository for which it is configured and you want to sync.
Of course, local repository should be properly configured into Trac (commit and incoming hooks configured and so on). Then also ticket updates through commit messages is possible.
Download the zipped source from here.
General instructions on installing Trac plugins can be found on the TracPlugins page.