Project

General

Profile

Actions

Patch #44599

open

Document in doc/RUNNING_TESTS how to speed up Mercurial tests by using chg

Added by Go MAEDA about 10 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Documentation
Target version:

Description

The attached patch adds a section to doc/RUNNING_TESTS that describes how to make the Mercurial tests much faster by using chg.

Unlike the commands of other SCMs such as Git and Subversion, the hg command is slow to start because it has to start the Python interpreter every time it is invoked. On my macOS machine, git --version takes about 0.01 seconds and svn --version about 0.06 seconds, while hg --version takes about 0.2 seconds. Since the Mercurial tests invoke hg 470 times, most of their run time is spent on starting the command.

chg is a client for the Mercurial command server and avoids this startup cost. To use it, set scm_mercurial_command in config/configuration.yml:

test:
  scm_mercurial_command: chg

I measured the run time of the following three Mercurial test files (98 tests in total) with hg and with chg:

  • test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
  • test/unit/repository_mercurial_test.rb
  • test/functional/repositories_mercurial_controller_test.rb

All tests passed in both cases.

Environment hg chg
macOS, Mercurial 7.1 177 seconds 27 seconds
GitHub Actions (Ubuntu 24.04, Mercurial 6.7.2) 102 seconds 29 seconds

The patch changes only the documentation.


Files

No data to display

Actions

Also available in: Atom PDF