Choosing Repositories


All Mercurial actions require you to choose at least one repository to work on.




By default, the repository specified in the global options will be used. You can override this and specify a folder, HTTP, HTTPS or SSH repository.


Mercurial supports almost all actions for all repository types, although there are some unexpected behaviours. For example, if you use a remote repository as the target for a Clone, it will create the repository but not any of the files.  For that reason, the general best practice is only use 'read' actions on remote repositories (such as the Clone source, Pull etc). All 'write' (Add, Update, Commit, Clone target etc) actions should be performed on local repositories.


The exception is Push, which is the recommended method for moving local changesets to a remote repository.


Access HTTP(S) Repositories

Choose the repository type, then specify the URL. You do not need to include the protocol in the URL, but you can if you want to. If you choose HTTPS you will be able to enter a username and password:




Your password is stored as an encrypted string in the FinalBuilder project file.


Accessing SSH Repositories

Mercurial provides SSH support by calling out to an external SSH application, which you need to configure. Getting Started with Mercurial has instructions for how to set up SSH and the same process needs to be followed to use Mercurial, SSH and FinalBuilder.


There is an additional complication if you want to run your builds from FinalBuilder Server. Pageant (the ssh key cache) requires you to interactively enter the password for your private key file, if you chose to protect it with one. As a result, if you want to use SSH in an unattended build, you need to use a private key file that is not password protected. Depending on your needs there's two ways to implement this.


If you want to use the same SSH key every time you use Mercurial the easiest thing to do is to modify Mercurial.ini to pass the location of the key as a parameter to your SSH client. For example:




ssh = C:\Users\ben\Downloads\plink.exe -ssh -i i:\open_key.ppk


Now every time Mercurial calls out to plink it will use the specified key. This is the simplest approach and is recommended if at all possible.


If you want to use different keys in different circumstances you should make use of Pageant. To do this, at the start of your FinalBuilder script create an Execute Program action that launches Pageant, passing the location of the key file as a parameter:




Be sure to deselect 'wait for completion'. If Pageant is already running it will add the specified key to the cache. If not, it will launch and add the key.


Recommended practice is to generate a key pair specifically for the build server/Mercurial server interaction and to not use the key for any other purpose.