Taking build version from Mercurial tags

Hi,

We’re taking the build version from Mercurial tags in our many existing builds (on FinalBuilder Server). Our old build scripts handle the hg operations manually and I’d like to avoid that in Continua (allowing Continua to clone and distribute the source) but we don’t have access to the hg log to get the latest tag and distance.

Am I missing something? Do we need to change our versioning strategy (or re-clone the repo ourselves)?

Thanks,

Robin

Hi Robin,
 
Continua CI will automatically read in the tags associated with each changeset (providing the Tag Changes drop-down for your Mercurial repository is not set to ignore tags). The tag names are exposed through the following expressions which can be used in action fields:

  • $Source.RepoName.BuiltChangeset.FirstTagName$ - The name of the first (or earliest) tag associated with the built changeset
  • $Source.RepoName.BuiltChangeset.LatestTagName$ - The name of the latest tag associated with the built changeset.
  • $Source.RepoName.BuiltChangeset.TagNames$ - A comma-delimited list of tags associated with the built changeset.
  • $Source.RepoName.BuiltChangeset.ChangedTagName$ - If the built changeset represents an addition, update or deletion of a tag to another changeset, this contains the name of the changed tag.

 These tag properties are also available on the following changeset expressions:

  • $Source.RepoName.LatestChangeset$ - The most recent changeset associated with the build. Note that a build may have more than one changeset if the Associate Changesets option is set to All Since Last Successful Build or a new changeset was added during a quiet period.
  • $Source.RepoName.LatestTriggeringChangeset$ - The latest changeset which triggered the build. Note that a build may have more than one triggering changeset if a new changeset was added during a quiet period.

 See Expression Objects for more details.

You can then set the Set Build Version action to update the build version to the tag name using one of these expressions.


Thanks! Looks like it’s not quite what we need though as Continua only seems to look at the built changesets.

I wasn’t clear in how we’re tagging (it might be that we’re unusual) - we’ll tag a changeset with a version (e.g. v3.1.2) but we don’t tag every changeset. The current script uses distance to that tag for the build number so for build 40, you’d get v3.1.2+40.

Any suggestions gratefully received.

Hi Robln,

We’ve been working on adding new expressions today so you can get access to the latest tag and the number of commits since the latest tag (on the current branch). This should be available for the next version .


Good to hear, thanks.