The latest version of FinalBuilder adds support for Mercurial: the popular, open source distributed version control system. This artcile will cover the basics of how to use Mercurial and Finalbuilder. It assumes that you have a good working knowledge of using Mercurial stand-alone. If not you might first like to read Getting Started with Mercurial.

FinalBuilder provides actions that cover the majority of Mercurial commands. There is also a 'generic' Mercurial action that allows you to run any Mercurial command without needing to create your own Execute Program action.

This article will run through how to do a basic automated build from Mercurial with FinalBuilder. It will also cover how to connect to repositories over HTTP and SSH.


Before using the Mercurial actions you will need to do some basic setup. In FinalBuilder, go to [Tools\Options], choose the [Version Control Systems] category and then choose [Mercurial]. Enter the directory where Mercurial is installed and optionally specify a default repository:

Most Mercurial actions will make use of the default repository if specified. You can choose to override it in each action.

If you want to run Mercurial actions as part of an unattended build, you should tick the "Run all actions in non-interactive mode" option. This will, where possible, stop Mercurial from prompting for user input.

The Build

Lets assume we have a 'master' repository on a Windows network share and that we're building a VS.NET solution. To create our build we will create a local clone of the master; increment the build number; perform the build; and push the build number change back to the master repository.

First, under [Tools\Options\Version Control Systems\Mercurial] change the default repository to the location of the master repository. Lets also make our lives a bit easier by creating a some Project Variables.

Add variables for the location of the local repository; the master repository; the .NET Solution directory; and the location of the AssemblyInfo.cs file. These can reference each other:


To make sure that Clone will work, we add an action that deletes the LocalRepo folder:

Check the "Ignore Failure" option on the [Runtime] tab - the action will fail if the folder doesn't exist, but we don't want to stop execution because of it.

Now, add a Mercurial Clone action. Leave the 'source' as the default (Master) repository and set the target to %LocalRepo%:

Add a Build VS.Net Solution action, using the SolutionDir project variable to specify the solution file:

On the [.NET Version] tab, tick the [Auto Increment Build] option:

Add a Mercurial Commit action, commiting the AssemblyInfo.cs change to the LocalRepo. On the [Options] tab, include a commit message so that you're not prompted for one at run time:


Add a Mercurial Push action, pushing the changes from the LocalRepo to the MasterRepo:


If the MasterRepo is a local repository add a Mercurial Update action for the MasterRepo. Push only moves the metadata regarding the changes: and Update is required if you want the MasterRepo working directory to contain the latest changeset.


You should now have a FinalBuilder project that looks like this:

Run it and check to make sure that

  1. The solution is being built correctly
  2. AssemblyInfo.cs changes are stored in the Master repository
Pages: 1 of 2 Next Page

Post Rating


There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.