hg status command can be very slow on a repository with thousands of files. This is because it has to explicitly check the status of every file. A great method to speed it up is the hgwatchman extension for Mercurial. It uses the Watchman tool which relies on the inotify mechanism of the Linux kernel to be notified directly of only the changes that occurred to the files in a directory. There are no packages of hgwatchman and Watchman for Ubuntu, so we need to build them from source. But it is pretty easy to do:
- Install the Watchman tool as described here.
Download the hgwatchman source code:
$ hg clone https://bitbucket.org/facebook/hgwatchman
- Build the code:
$ cd hgwatchman $ make local
If you forget this step, everything seems to be fine until you start seeing this error:
$ hg status abort: No module named bser!
bser.so is a module that is built by this step.
- Add these lines to your
[extensions] hgwatchman = /path/to/hgwatchman/hgwatchman [hgwatchman] mode = on
- That is it! You should see a nice improvement in the performance of
hg statusafter using hgwatchman.
Tried with: Watchman 3.0.0, Mercurial. 2.8.3 and Ubuntu 14.04