Download Code Style Enforcer 3.0.71
One solution to this is of course to pull, update, merge (if needed) and commit, or the Hg Fetch extension, but what we really wanted was to somehow prevent developers to push change sets into the remote server repository during the build process of that specific project in TeamCity.
After quite a lot of research on Google, I still couldn’t find any existing solution to this, so I started thinking about how we could manage this ourselves. The solution I came up with was to develop a very simple, but yet quite smart, REST service hosted on the same machine as the Hg repositories. The service exposes endpoints for EnablePush/DisablePush together with the name of the target repository. What the service implementation does is then to temporarily change the hgrc file in the repository to disable push, but not for everyone, since the automated build account used by TeamCity for Mercurial still needs Push access (allow_push = Mercurial). In order to enable Push again when the build is completed we then allow everyone with an account in the AD to Push again (allow_push = *).
In order to use the REST service from TeamCity I discovered a very useful plugin called tcWebHooks that allows HTTP POST on TeamCity events like build started and build completed. Here is a configuration example of tcWebHooks for enabling/disabling Hg Push for a specific project and repository using the custom made RIA service.
If you’re interested in the service install package or source code, let me know and I’ll send it to you!
Download Code Style Enforcer 3.0.51
Download Code Style Enforcer 3.0.43
There seems to be some incompatibility issue with this new version of DXCore, but a new version of Code Style Enforcer targeting DXCore 2010 vol 2.3 will be released within the next couple of days!