Version control with Mercurial

Mercurial is an open source distributed version control system initially designed as a replacement tool for Linux kernel development. In Perforce TeamHub, you can create any number of Mercurial repositories in your projects.

The below is the list of resources to help you learn Mercurial:

Setting up

Download and install the latest version of Mercurial client and open your Terminal.

Introduce your name and email to Mercurial, so that TeamHub can display your user account correctly. Please specify the same email address you use to sign in to TeamHub:

Open ~/.hgrc (or on a Windows system in %USERPROFILE%\Mercurial.ini) by creating it and adding the following lines:

username = YOUR NAME <[TEAMHUB EMAIL ADDRESS]>

Configure your SSH keys under your TeamHub Profile settings and start working with Mercurial.

For example, to clone the "bar" Mercurial repository from the "foo" project in "acme" company with SSH, issue the following command in the terminal:

hg clone ssh://hth@helixteamhub.cloud/acme/projects/foo/repositories/git/bar

To clone the same repository with HTTP:

hg clone http://[TEAMHUB USERNAME]@helixteamhub.cloud/acme/projects/foo/repositories/mercurial/bar

Migrating existing Mercurial (HG) repositories to TeamHub

The following steps are needed in order to migrate existing Mercurial repositories to TeamHub:

  1. Create a new repository in TeamHub project. You can accomplish this either through quick actions or from the repositories screen:

    Create new repository from quick actions

  2. Clone the repository you wish to migrate:

    hg clone <OLD-REPOSITORY-URL>

  3. Go to the repository directory:

    cd <YOUR-REPOSITORY-NAME>

  4. Obtain the clone URL for the repository you created in TeamHub from the repository view:

    Helix TeamHub Git repository clone URL

  5. Push the repository to TeamHub:

    hg push <TEAMHUB-REPOSITORY-URL>

    If you copied the clone URL with SSH as an access method, you need to have your SSH key added to TeamHub in order to push the changes.

  6. Clone the repository from TeamHub to a new directory. Alternatively, you can change the new clone URL to the [paths] section of .hg/hgrc file in the repository.