Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use hgwatchman extension for Mercurial

📅 2015-Feb-11 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ extension, hgwatchman, inotify, mercurial, watchman ⬩ 📚 Archive

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:

$ hg clone https://bitbucket.org/facebook/hgwatchman
$ 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.

[extensions]
hgwatchman = /path/to/hgwatchman/hgwatchman

[hgwatchman]
mode = on

Tried with: Watchman 3.0.0, Mercurial. 2.8.3 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧