Branching Mercurial on release with TeamCity, and managing version numbers

Is there a way to automatically branch a mercurial repository and update version numbers of another build when a TeamCity build is run?

I have been using mercurial with TeamCity for a while, and I am pretty close to a build and deployment nirvana.

For each project I have a CI build and a Release build. The CI build runs on each commit, runs my tests and deploys to a staging environment where acceptance tests are run and UAT is performed. This build increments the version build number 0.0.0.*

When the build is accepted by my customer I want to click my release build, and have it create a branch in Mercurial, named using this format: 0 . * . x . x  Then the build must run the build on the new branch. This build gets it’s version number from the last successful CI build. When this build finishes, I would then like to increment the minor version number (0 . * .  0 . 0) on the CI build, and reset the CI build’s build count of the build number (0.0.0.*).

Can anyone give me pointers on either the versioning or the Mercurial branching  i.e

On successful Release build, incrementing the minor version number on the CI build that is currently incrementing the build version number, so also need to reset the count of the build version number on the CI build.

Branching mercurial when a Release build is started, then doing the build in that branch. The new branch should be named after the major and minor version number of the last CI build. This build already uses the version number set by the last CI build.


Please sign in to leave a comment.