My understanding is that neither Git nor Mercurial can do this well out of the box, and FB and Google both have their own extensions to Mercurial to make this possible (because even though Mercurial is often slower than Git, it’s extensible)
e.g. https://facebook.github.io/watchman/ - used as part of Facebook’s Mercurial solution, I think.