Mercurial Integration

Applies to Collaborator 14.6, last modified on July 10, 2024

Collaborator seamlessly integrates with the Mercurial source control system. This section provides a general overview of integration preferences, ways to review files controlled by Mercurial, and so on.

About Integration

Using the built-in Collaborator Mercurial integration, you can quickly upload various files to the Collaborator server to create a review directly from the desktop client of your choice. The types of files you can upload include:

  • Files controlled by Mercurial.
  • Arbitrary Mercurial diffs.

Mercurial integration uses Mercurial client applications that are already installed on the client computer. That is, integration supports all protocols, authentication settings, proxies, and other configuration specifics.

Supported Versions

To enable the integration via GUI Client and Command-Line Client, you need hg v1.0 or later, as we use the -U flag to provide full context lines of differences so that the uploaded versions can contain the full file content of the previous and current file versions. The TortoiseHg client is not supported.

Remote Repositories Support

If your Mercurial repository is located on one of the popular source hosting services – such as Bitbucket – you may want to automatically create and update reviews when changes occur in your remote repositories. For that purpose, you can use the built-in Collaborator integration with these services. To learn more about possible options for integration, see Integration With Repository Hosting Services.

Ways of Integration

You can enable the integration between Collaborator and Mercurial for GUI Client or Command-Line Client

GUI Client

To enable the integration:

  1. Start GUI Client.

  2. Click Add to create a new SCM configuration.

  3. In the subsequent SCM Configuration dialog, specify the local source code location. Then, select Mercurial in the SCM drop-down list.

  4. In Mercurial-exe, specify the full path to the Mercurial command line client (mercurial.exe).

    Mercurial Configuration
  5. Once ready, click Validate to make sure the integration is operational.

After that, a new configuration for Mercurial will appear on the main screen of the GUI Client.

Select it, then click on the corresponding button depending on what you want to do next:

Buttons for Mercurial files uploading
  • Add Changes – Upload files that have been edited locally to the Collaborator server and add them to a review.

    Add Changes
    Note: These are the files that would be uploaded in Mercurial, should you enter hg commit in a command line.

    If this button is inactive, specify the correct location of the source files in the SCM Configuration dialog.

  • Add Mercurial Diffs – Upload arbitrary Mercurial diffs to the Collaborator server and add them to a review.

    Upload arbitrary Mercurial diffs
    Note: If you have not specified an appropriate location of the source files in the SCM Configuration dialog, then you will have to provide absolute paths to the needed files while preparing the upload.

Command-Line Client

In the Command-Line Client, you can create a review for changes you have applied locally to files controlled by Mercurial – before uploading these to the version control repository.

Commands recommended for Mercurial

ccollab addchanges - Attaches locally-modified files to a review.

ccollab addhgdiffs - Uploads diffs generated by hg diff command.

In most cases, the Command-Line Client can automatically detect your Mercurial configuration. Try testing your configuration to verify the configuration is detected correctly.

If the Command-Line Client is unable to detect your Mercurial configuration or you want to override the detected settings, you can manually specify Mercurial settings using global options.

To manually configure the Command-Line Client to use Mercurial, execute the following command:

ccollab set scm mercurial

Mercurial-specific Options



--mercurial-exe <value>

Full path to the "mercurial (hg)" command line client.

Technical Details and Limitations

Collaborator does not guarantee that Diff Viewer will display correct comparison results for the following cases:

  • If you add several diffs (non atomic changelists) to the same review.

See Also

SCM Configuration
ccollab set
Source Control Integrations

Highlight search results