How to use inotify extension for Mercurial

hg status is the slowest command in Mercurial and can take several seconds on repositories with thousands of files. This is because it needs to check every single file and directory in your repository to see if it has changed. One method to speed up this command is to use the inotify extension for Mercurial.

Note: This extension is reported to be buggy and using the alternate hgwatchman extension is recommended.
Note: This extension only works in Mercurial 2.x. It has been explicitly disabled in Mercurial 3.x and will not work.

This extension ships with the mercurial-common package and so it will already be installed on your system if you have Mercurial. It relies on the inotify subsystem of the Linux kernel and any kernel later than 2.6.13 will have it. It uses the filesystem to watch for changes and reports these to applications. Using this Mercurial can check the status of gigantic repositories quickly.

To enable this extension, just add these lines to your hgrc:

inotify =

That is it! I noticed a speedup on a large repository with 500K files, but it was not as much as I wanted.

Tried with: Mercurial 2.8.2, Linux 3.13.0 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.