Access to Mercurial integer revision numbers?

We want to code the Mercurial revision number into our builds.  These builds are currently not .NET but will eventually be .NET, so we are anticipating the need for compatibility with .NET version numbers, which require integer values that fit in 16-bits.  The key here is that they be integer values.

The Mercurial build number is currently the hash of the changeset.  This is all well and good, and as it should be according to the Mercurial authors, since that is the only thing that uniquely globally identifies the changeset.  However, that will not work as a .NET version number since it is a hash, not an integer.  It is also unsightly for my non-.NET builds.

There is a repository-specific monotonically-increasing revision number that Mercurial provides for convenience as well.  It's this build number I'd like to use for versioning since there is only one master repository, guaranteeing the usefulness of the information, and because it will fit within the .NET constraints as well as "looking" like a revision number to the eye.  Is there a field or can there be added a field that makes this information available?  Naturally, this shouldn't take over the build.vcs.number field, but should be separate.



1 comment
Comment actions Permalink

There is no such feature out of the box. Although it is possible to expose Mercurial revision number, we would like to gather more votes on this feature before implementing it. I would suggest to submit a feature request to our tracker.

Since Mercurial plugin sources are available you can chose to modify it by yourself. Let us know if you want to go this way and if you unsure from where to start.


Please sign in to leave a comment.